Changeset 3697
- Timestamp:
- 07/20/2016 04:40:34 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/handbook.php
r3689 r3697 123 123 add_action( 'template_redirect', array( $this, 'redirect_handbook_root_page' ) ); 124 124 add_filter( 'template_include', array( $this, 'template_include' ) ); 125 add_filter( 'query_vars', array( $this, 'add_query_vars' ) ); 125 126 add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ) ); 126 127 add_action( 'widgets_init', array( $this, 'handbook_sidebar' ), 11 ); // After P2 … … 267 268 if ( is_singular( $this->post_type ) 268 269 && 269 ! is_post_type_archive( $this->post_type)270 ! get_query_var( 'is_handbook_root' ) 270 271 && 271 272 in_array( get_query_var( 'name' ), array( $this->post_type, substr( $this->post_type, 0, -9 ) ) ) … … 293 294 } 294 295 // For handbook landing page. 295 elseif ( is_post_type_archive( $this->post_type )) {296 elseif ( get_query_var( 'is_handbook_root' ) && get_query_var( 'handbook' ) === $this->post_type ) { 296 297 if ( 'handbook' !== $this->post_type ) { 297 298 $handbook_templates[] = "single-{$this->post_type}.php"; … … 307 308 308 309 return $template; 310 } 311 312 /** 313 * Add public query vars for handbooks. 314 * 315 * @param array $public_query_vars The array of whitelisted query variables. 316 * @return array Array with public query vars. 317 */ 318 function add_query_vars( $public_query_vars ) { 319 $public_query_vars['is_handbook_root'] = false; 320 321 return $public_query_vars; 309 322 } 310 323 … … 319 332 if ( $page ) { 320 333 $query->set( 'p', $page->ID ); 321 $query->is_singular = true; 334 $query->set('is_handbook_root', true ); 335 336 $query->is_archive = false; 337 $query->is_post_type_archive = false; 338 $query->is_single = true; 339 $query->is_singular = true; 322 340 } 323 341 $query->set( 'handbook', $this->post_type );
Note: See TracChangeset
for help on using the changeset viewer.