Changeset 7821
- Timestamp:
- 11/04/2018 12:05:24 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/widgets.php
r7758 r7821 71 71 $this->post_types = array_map( array( $this, 'append_suffix' ), $this->post_types ); 72 72 73 if ( in_array( $post->post_type, $this->post_types ) ) { 74 $args['post_type'] = $post->post_type; 73 $post_type = ''; 74 75 if ( $post && in_array( $post->post_type, $this->post_types ) ) { 76 $post_type = $post->post_type; 77 } elseif ( is_post_type_archive( $this->post_types ) ) { 78 $post_type = reset( $this->post_types ); 75 79 } 76 80 77 $post_type_obj = get_post_type_object( $post->post_type ); 81 if ( $post_type ) { 82 $args['post_type'] = $post_type; 83 } 84 85 $post_type_obj = get_post_type_object( $post_type ); 78 86 79 87 if ( current_user_can( $post_type_obj->cap->read_private_posts ) ) { … … 82 90 83 91 // Exclude root handbook page from the table of contents. 84 $page = get_page_by_path( $this->append_suffix( $post ->post_type ), OBJECT, $post->post_type );92 $page = get_page_by_path( $this->append_suffix( $post_type ), OBJECT, $post_type ); 85 93 if ( ! $page ) { 86 $slug = substr( $post ->post_type, 0, -9 );87 $page = get_page_by_path( $slug, OBJECT, $post ->post_type );94 $slug = substr( $post_type, 0, -9 ); 95 $page = get_page_by_path( $slug, OBJECT, $post_type ); 88 96 } 89 97 if ( $page && ! $instance['show_home'] ) {
Note: See TracChangeset
for help on using the changeset viewer.