Articles of template hierarchy

Custom term templates

So, I did some research online but could not find a solid answer, so here I am. I am in need to make a custom woocommerce category page for a specific category. For example, I have a category called “Awesome”. Instead of using a regular category page, generated by a shortcode[product_category category=”something”], I want to […]

worpress sub taxonomy template

please see my code structure custom post type name : product custom taxonomy associated with product : category main category inside category taxonomy :main1, main2 etc sub taxonomy inside main1 : sub1, sub2 etc i need to create template for all sub category and this templates are same . so i need to create one […]

Custom Post Type homepage template

This is what I want: I have made a Custom Post Type in my theme and it shows in my home too, but the problem is that tha CPT takes the same elements and style of a default post in WordPress, how I can assign a template for how my CPT is displayed at my […]

The best way to create pages like an 'about', 'contact' and etc

I develop my own theme and I need to create nice looking sites like a contact page or about me page. But I don’t have any idea what wordpress template file I can use. Will I have to use page-template or something else? How do they do a premium themes?

Different Loop for tag pages?

I have a theme that uses one template file to render the index of the blog, the loop is basic: if ( have_posts() ) : while ( have_posts() ) : the_post(); I want to use another custom loop for all my is_tag( ” ) pages. if ( is_tag() ) { if ( have_posts() ) : […]

Where to put custom page templates in theme?

I am building a theme (parent theme) and I was advised to put custom page templates in theme root folder. I am copying theme twenty fourteen and found this theme using a separate directory called page-templates for keeping custom page templates but it does not work with my theme? Can i know why twenty fourteen […]

Template hierarchy: how to let category.php conditionally-load archive.php?

In WordPress template chaining for categories, we have WP looking for: category-slug.php → category-id.php → category.php → archive.php → index.php Now, I’d like to make some tweaks in category.php, for instance insert some conditions over there, and if the condition is true, use a particular template (custom) otherwise continue processing the chain moving control as […]

Which php file lists all the post of a category

In my primary menu, I have added a category “News & Events” and when I click this page, I get all the posts of this category. Which php file I have to edit, in order to change some things that I don’t want to appear when the posts are listed in that page?

single.php with different look by category

I’m trying to find a way to get my posts with different look depending on their category. I have first tried to do it using the template hierarchy but it seems there is no pattern for the category posts. (ie single-cat-mycategory.php) So then within single.php I tried the conditional tagging using is_category() but my understanding […]

Custom post type not respecting template hierarchy

I have a custom post type, case-study, defined in my functions.php like so: function case_study_posttype() { register_post_type( ‘case-study’, array( ‘labels’ => array( ‘name’ => __( ‘Case Studies’ ), ‘singular_name’ => __( ‘Case Study’ ) ), ‘public’ => true, ‘has_archive’ => true, ‘rewrite’ => array(‘slug’ => ‘case-study’), ‘supports’ => array(‘title’, ‘editor’, ‘excerpt’, ‘author’, ‘thumbnail’, ‘comments’, ‘revisions’, […]