Making WordPress.org


Ignore:
File:
1 edited

Legend:

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

    r10781 r8942  
    1111    protected static $widget_id_base = 'handbook_pages';
    1212
    13     protected $post_types;
     13    protected $post_types = array( 'handbook' );
    1414
    1515    /**
     
    7272        }
    7373
    74         $this->post_types = WPorg_Handbook_Init::get_post_types();
     74        $this->post_types = (array) apply_filters( 'handbook_post_types', $this->post_types );
     75        $this->post_types = array_map( array( $this, 'append_suffix' ), $this->post_types );
    7576
    7677        $post_type = '';
     
    9394
    9495        // Exclude root handbook page from the table of contents.
    95         $page = get_page_by_path( $post_type, OBJECT, $post_type );
     96        $page = get_page_by_path( $this->append_suffix( $post_type ), OBJECT, $post_type );
    9697        if ( ! $page ) {
    97             $slug = str_replace( '-handbook', '', $post_type );
     98            $slug = substr( $post_type, 0, -9 );
    9899            $page = get_page_by_path( $slug, OBJECT, $post_type );
    99100        }
     
    107108
    108109        return $args;
     110    }
     111
     112    public function append_suffix( $t ) {
     113        if ( in_array( $t, array( 'handbook', 'page' ) ) ) {
     114            return $t;
     115        }
     116
     117        return $t . '-handbook';
    109118    }
    110119
Note: See TracChangeset for help on using the changeset viewer.