"Template hierarchy" describes process by which WordPress determines which theme files to use when displaying a query. Index.php is the fallback for all queries, and, theoretically, the only theme file required other than style.css.

learn more… | top users | synonyms

7
votes
2answers
516 views

What is singular.php?

From 4.3 we have a new template, singular.php. I tried to understand what is it, but I didn't get it. :) The page.php for pages. The single.php for every post types. If we have single-[post-type].php ...
0
votes
1answer
25 views

Utilizing the template hierarchy while storing page templates in a subdirectory

I'd like to store the page templates for my theme in their own directory, /pages/ for example. I'd also like to utilize the page-{slug}.php functionality of the Template Hierarchy, and not have to ...
0
votes
0answers
33 views

Use different file includes for single.php

I'm beginning to convet html to Wordpress, I've some problem in single.php to show the post with different headers because mysite use in English and Arabic language. My site containings Arabic and ...
1
vote
1answer
48 views

Template Hierarchy tag-{slug}.php directory

When tag-{slug}.php is in the root of theme, say wp-content/themes/p2/tag-{slug}.php, the template hierarchy is respected. However, I have many such custom files and just cannot have it in the theme ...
2
votes
0answers
31 views

Loading partial templates with AJAX/PJAX

I am trying to load content using PJAX (basically AJAX with history). So far I have managed to catch PJAX requests and load the correct content. My problem is finding the correct template to use for ...
0
votes
0answers
16 views

WordPress Template Files added to directory after migration to Debian Server do not load, White Screen of Death

Okay here's the backstory: I run and develop a WordPress-based site. I work mostly in my editor and do not use the core WordPress backend anymore than I have to, I typically just work in template ...
0
votes
0answers
23 views

Best way to add custom code to pages in Wordpress

I've a question relating to Page templates in Wordpress. Firstly, I should point out that I'm about to undertake quite a large project for a friend of mine and I'm looking to to it in the best way ...
2
votes
1answer
54 views

Overriding default template if page slug and post type are same

I have created a post type named 'faq', and a page 'faq' for displaying the posts under faq. Also I have created a page template name faq and selected the faq page's template to this. Now the ...
0
votes
1answer
36 views

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 ...
0
votes
0answers
34 views

Custom Homepage As Single Page or Custom Post Type?

Conceptual question for the WP community: I need to implement a custom homepage for a new site. It has some custom stuff going on but nothing too crazy: 4 big images, a carousel, some calls to action ...
0
votes
1answer
71 views

Ajax specific template not loading in replacement of index.php

Following my previous post (Full-Ajax Theme: parseJSON error while building a JSON object from a Wordpress custom template) regarding a few problems concerning JSON (now resolved), I am trying to load ...
0
votes
3answers
111 views

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 ...
0
votes
1answer
32 views

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 ...
0
votes
1answer
47 views

Taxonomy-$taxonomy-$term not working

This question might seem very simple, but I cannot find a proper answer for it. In my example I should have multiple pages that should display 'FAQ'. For that I have added custom taxonomy page_type ...
0
votes
2answers
58 views

Understanding the Template hierarchy

I've got a template called News. When I go to the Dashboard and edit the Page called News which has a web address of news.html I can see it uses this template (i.e. in the Page Attributes > Template ...
0
votes
1answer
25 views

Creating a Taxonomy Page [duplicate]

I am having a hard time wrapping my head around the way to set up a taxonomy template page. My goal is to create a taxonomy archive of a custom taxonomy I created. The page would only need to contain ...
0
votes
0answers
121 views

How to stop the search results from loading the wrong template?

I have a custom themed site which is not using the correct page template to display search results. I inherited the site with the theme and I'm now trying to make some changes; I did not create the ...
1
vote
1answer
148 views

Displaying all Video Post Formats to Page

I am creating a video-archive page for all the posts_format with video. Currently, I have: <?php $format = has_post_format('video', $post_id); ?> <?php if($layout != "fullwidth") { ...
0
votes
2answers
44 views

Custom templates vs page-slug

I've currently been using the slug to set the page template, using the normal hierarchy For example, if I wanted to change the page template for http://www.example.com/about-us, I would edit ...
0
votes
1answer
52 views

Which template name to use for taxonomies but not their terms?

I can't figure out which template name to use to modify custom taxonomy archive page, but not the one for terms in that taxonomy. My goal is to show terms list in custom taxonomy archive and in ...
1
vote
0answers
31 views

rewrite taxonomy-{taxonomy}-{term}.php terms

I try to figure out a rewrite problem, that is a somewhat over my head, so i ask here to find out what i can do. I use this two solutions from Jeff 1 and Milo 2, to get a full-path url for my custom ...
0
votes
1answer
98 views

Assigning custom page templates to a static blog page

I'm searching for the best solution to create custom layouts for blog pages in WordPress. Where you would normally select a custom page template from the Template metabox in admin to change the page ...
1
vote
1answer
53 views

Custom post type templating problem

I have a custom post type named 'product', with taxonomies 'brand' and 'type'. I'd like to have Archive Page A: sidebar with all the 'brand' terms linking to their respective archive page list of ...
1
vote
0answers
49 views

How to use multiple archive templates for a taxonomy?

I have created a custom post type (product) with a taxonomy (brand). I need to have the basic archive pages (type A) and then custom ones (type B) to create a product comparison page which esentially ...
0
votes
0answers
68 views

Page Templates Used in Custom Post Type

The same question was asked here with no real response. They claim it's not possible but I have used plugins that accomplish this. In WordPress I am having a problem figuring out how to use the ...
0
votes
1answer
41 views

Show a custom template, no matter the page being viewed, if the user is not logged in

I have been tasked with creating a WordPress site where subscriberes (registered by an admin) are unaware of the back-end. I also have to make it so that upon navigation to any page, if the user is ...
1
vote
1answer
156 views

Is there a way to set different post templates for parent posts and child posts in the same post type?

After taking a look through the questions suggested to possibly have my answer, I still can not seem to find something that I references the post-template php files. I have two custom post types that ...
1
vote
0answers
121 views

WordPress Filtering Custom Post Type by Metadata and Search Heirachy

I have a custom Post Type called cptMovie which has two Custom Field (Metadata) "Language" and "Box office" assigned to it. I also have a Custom Taxonomy called movieTax with 4 tax Terms "Action", ...
0
votes
1answer
65 views

LOST in WP Template Hireachy

I am trying to create a Custom Theme which is supposed to list and dialysis Custom Post Types First Base on Taxonomy and In next page List and Display Them based on Taxonomy Term which linked from the ...
0
votes
1answer
31 views

Needed to change slug to access page

I've created a page, with the slug "news". Something happened because now I can't access /news .. I needed to change the slug to "news_", or something, to access that page. I checked the database to ...
0
votes
1answer
103 views

Displaying a custom post type and an archive page

I have created a custom post type called articles that will display an article each month. This custom post is hierarchical (which means it will also have children posts related to that monthly ...
0
votes
2answers
874 views

Custom Post Type with Nested Taxonomy and Template Files

I have a custom Post Type of "Portfolio" with a rewrite slug of portfolio. So the URL on the frontend is: domain.com/portfolio. I have a custom Taxonomy of "Categories" with a rewrite slug of ...
2
votes
2answers
899 views

Template for specific post of custom post type

I have the CPT "event". I have created single-event.php. I want one particular event to use a different template than single-event. I read elsewhere that this could be done by creating a ...
0
votes
3answers
429 views

Use one template only for custom post type archives?

I'm currently using archive.php as a generic listing for categories, tags, authors, etc. However, my custom post types have a very customized archive page that's completely different from archive.php. ...
0
votes
1answer
472 views

Getting custom taxonomy posts on archive page

Hi I am not sure if the question is understandable or not but what I am trying to achieve I will explain. I have a custom post type called menu item and custom taxonomy called menu item type. CODE ...
1
vote
4answers
365 views

Create static front-page with 3-5 recent posts

I am struggling with front/landing page customization for my custom designed theme. I have designed custom theme and pretty much coded it using the Underscore boilerplate. As I understands, the ...
0
votes
0answers
247 views

Wordpress Page doesn't load the template selected

I've created a new page called Work and I've added it on the navigation bar; after that I've created a file called work.php in which I want to style the page mentioned above. The problem is that the ...
0
votes
1answer
179 views

localizing variable on front-page.php template fails but succeeds on single page and taxonomy archive

I have the following code in a php include file: function pass_the_var() { $video_embed_code = jkaw_oembed_code(); return array( 'embedCode' => $video_embed_code ); } ...
0
votes
0answers
43 views

Most efficient way to have 1 template for parent, 1 template for child categories?

This is the setup I want: For category-15.php: Child Category A (list of all posts inside) Post A from Child Category A Post B from Child Category A Post C from Child Category A ...
0
votes
1answer
141 views

Loading custom page template on a one page website

For a one page website, I have modified the homepage to index all pages instead of posts. For some of the pages I want to create a custom template (like page-slug.php). But, these template only get ...
0
votes
0answers
67 views

How to display custom taxonomy

I have created city taxonomy in back end and i have added mumbai,pune,nashik city in city taxonomy like bellow snipe. My problem is that when i click the city for example mumbai i want display the ...
0
votes
0answers
321 views

Passing query variables to a custom page template

On my website I have a custom post type called 'theme'. I wanted the homepage to display an archive of themes. For this the only approach that I could think of was to create a page template with a ...
0
votes
0answers
28 views

WP Template Hierarchy - Need help choosing the correct templates

Please see this image to get a better understanding of what I would like to achieve. Please pay attention to point #3 and #4 (notice the permalink structure). The "Homepage" is static ...
1
vote
2answers
850 views

How to make child categories recognize parent's template displays

I'm using the Default Post Type post for various purposes. To sort them I'm using different categories. And I'm designing different category layout using the slug preference, like: category-book.php, ...
0
votes
2answers
476 views

Use meta boxes inside an archive page template for Woocommerce

I'm creating my own Wordpress theme, and I'm trying to make it compatible with Woocommerce. I understand pretty much everything about theming woocommerce, including copying the template files and ...
12
votes
2answers
4k views

How to create custom 401, 403 and 500 error pages?

When a 404 error is encountered, a 404.php template file can be used to render a custom error message. This is documented in the Template Hierarchy article. My aim is to create custom error pages ...
0
votes
3answers
1k views

How can I conditionally show different home page templates based on whether or not the user is logged in?

How can I conditionally load HTML for the home page based on whether or not the user is logged in? Currently my theme has an index.php file. In that file I tried to create: <?php ...
0
votes
0answers
41 views

Template for Custom Post Type and its Category

I have created a custom post-type ( Testimonials ) and i have custom taxonomies for this post-type to separate the testimonials. Custom Testimonial Taxonomies are 1) Commercial 2) Residential Now, i ...
0
votes
1answer
114 views

page_template toggle between 2 templates + 2 permalinks for same post

I'm trying to use this page_template template from the WP forums, with the same aim as the original author: I am trying to use two separate permalinks/templates for a single post - each ...
1
vote
1answer
186 views

Single page template for custom post_type

I registered a custom post type with the following code: #Register custom post type for Stars of the Month add_action( 'init', 'sdp_create_star_type' ); function sdp_create_star_type() { ...