Making WordPress.org

Ticket #1731: 1731.patch

File 1731.patch, 1.3 KB (added by keesiemeijer, 9 years ago)

Fix notice

  • sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/template-tags.php

     
    3737        }
    3838
    3939        foreach ( $post_types as $post_type ) {
    40                 $is_handbook    = ! $handbook || ( $handbook === $post_type );
    41                 $handbook_query = is_singular( $post_type ) || is_post_type_archive( $post_type );
     40                $is_handbook     = ! $handbook || ( $handbook === $post_type );
     41                $single_handbook = false;
    4242
     43                if( is_singular() ) {
     44                        $queried_obj = get_queried_object();
     45
     46                        if( !empty( $queried_obj ) ) {
     47                                $single_handbook = is_singular( $post_type );
     48                        } else {
     49                                // Queried object is not set, use the post type query var.             
     50                                $qv_post_type = get_query_var('post_type');
     51
     52                                if ( is_array( $qv_post_type ) ) {
     53                                        $qv_post_type = reset( $qv_post_type );
     54                                }
     55
     56                                $single_handbook = ( $post_type === $qv_post_type );
     57                        }
     58                }
     59
     60                $handbook_query = $single_handbook || is_post_type_archive( $post_type );
     61
    4362                if ( $is_handbook && $handbook_query ) {
    4463                        return true;
    4564                }