Making WordPress.org


Ignore:
File:
1 edited

Legend:

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

    r8942 r10781  
    1111    protected static $widget_id_base = 'handbook_pages';
    1212
    13     protected $post_types = array( 'handbook' );
     13    protected $post_types;
    1414
    1515    /**
     
    7272        }
    7373
    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 );
     74        $this->post_types = WPorg_Handbook_Init::get_post_types();
    7675
    7776        $post_type = '';
     
    9493
    9594        // Exclude root handbook page from the table of contents.
    96         $page = get_page_by_path( $this->append_suffix( $post_type ), OBJECT, $post_type );
     95        $page = get_page_by_path( $post_type, OBJECT, $post_type );
    9796        if ( ! $page ) {
    98             $slug = substr( $post_type, 0, -9 );
     97            $slug = str_replace( '-handbook', '', $post_type );
    9998            $page = get_page_by_path( $slug, OBJECT, $post_type );
    10099        }
     
    108107
    109108        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';
    118109    }
    119110
Note: See TracChangeset for help on using the changeset viewer.