How to force sub-product-category to use the parent category template

I solved it, after facing these 2 issues: 1- use template_include in filter instead of taxonomy_template 2- I reordered these lines according to my need. // Current first $templates[] = “category-{$category->slug}.php”; $templates[] = “category-{$category->term_id}.php”; // Parent second $templates[] = “category-{$parent->slug}.php”; $templates[] = “category-{$parent->term_id}.php”; $templates[] = ‘category.php’; So here is my final code: /** * Filter … Read more

WordPress Page Hierarchy

This is all fixed. I still had a template assigned to the page in question (press), so it was taking priority. The page you’re now seeing is correct in that it is pulling in content from a custom post type (Recent Stories) after the standard page content from the loop. Thanks for the help. Brett

where is the code that executes the template hierarchy?

wp-includes/template-loader.php is the file which is the template hierarchy. However, by the time that file executes, all the template decisions are already made since all that file does is check for boolean flags (defined in wp-includes/query.php function init_query_flags). So all the heavy-lifting and interesting code happens before that at wp-settings.php line 225: $wp_the_query = new … Read more

Load custom template for specific GET parameter

Just found an pretty straightforward solution for this problem: add_action( ‘template_include’, ‘account_page_template’ ); function account_page_template( $template ) { if( isset( $_GET[ ‘account’ ] ) ) { return locate_template( array( ‘account.php’ ) ); } return $template; } But as it seems only natural to use some kind of permalink stucture for these kind of things here … Read more

How to use a specific category archive index as the site front page?

Create a file front-page.php with the following content: locate_template( ‘category-image-gallery.php’, TRUE, TRUE ); That’s all. For the theme’s functions.php If you want to restrict the front page content to posts from that category, filter the front page query: add_action( ‘pre_get_posts’, ‘wpse_74225_frontpage_categories’ ); function wpse_74225_frontpage_categories( $query ) { if ( $query->is_main_query() && is_front_page() ) { $query->set( … Read more