Making WordPress.org

Changeset 3478


Ignore:
Timestamp:
06/19/2016 09:50:03 PM (10 years ago)
Author:
coffee2code
Message:

Handbook plugin: Add a fallback check for a page with the slug of the handbook's post type (without '-handbook') when attempting to locate handbook root page.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/handbook.php

    r3236 r3478  
    212212                if ( $query->is_main_query() && ! $query->is_admin && ! $query->is_search && $query->is_post_type_archive( $this->post_type ) ) {
    213213                        // If the post type has a page to act as an archive index page, get that.
    214                         if ( $page = get_page_by_path( $this->post_type, OBJECT, $this->post_type ) ) {
     214                        $page = get_page_by_path( $this->post_type, OBJECT, $this->post_type );
     215                        if ( ! $page ) {
     216                                $slug = substr( $this->post_type, 0, -9 );
     217                                $page = get_page_by_path( $slug, OBJECT, $this->post_type );
     218                        }
     219                        if ( $page ) {
    215220                                $query->set( 'p', $page->ID );
    216221                        }
Note: See TracChangeset for help on using the changeset viewer.