Changes between Version 1 and Version 2 of Ticket #16373, comment 11
- Timestamp:
- 01/19/2014 12:33:20 AM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #16373, comment 11
v1 v2 13 13 if ( '' != get_query_var( 'foobar' ) ) { // Registered custom query var 14 14 $query->set( 'page_id', get_option( 'page_on_front' ) ); 15 $query->is_home = false;16 15 $query->is_page = true; 16 $query->queried_object = get_post(get_option('page_on_front') ); 17 17 } 18 18 } … … 20 20 } 21 21 add_action( 'pre_get_posts', 'themeslug_force_static_front_page' ); 22 23 function themeslug_force_front_page_template( $template ) {24 if ( '' != get_query_var( 'foobar' ) ) { // Registered custom query var25 return get_front_page_template();26 }27 return $template;28 }29 add_filter( 'template_include', 'themeslug_force_front_page_template' );30 22 }}} 31 23 32 == Edit ==24 == Edit (2) == 33 25 34 Actually, the `pre_get_posts` is ''not'' working. Only the `template_include` is working to force the front page template. So, partial work-around.26 Edited to add a functional workaround, that results in `is_front_page()` returning `true`.