"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

4
votes
2answers
37 views

Overide get_template_part( 'partials/post', 'sidebar' ); with a plugin

I am working on a site for a client who has a theme built for them by a different developer. They have asked me to make some changes to the site, and I'd like to put all of my changes into a plugin as ...
0
votes
2answers
22 views

How to put articles under a /blog directory?

I have a homepage, work (as parent pages) and several pages (as child), but when it comes to articles, I can't choose the relation between them and the page Blog. Resuming, I can choose the hierarchy ...
1
vote
1answer
39 views

Is there any way to get all the name or slug of template parts used in a page?

I am developing a custom plugin where I am using a single page template and changing the template parts only using ajax,I want to retrieve the template parts slugs or name (like custom-header.php, ...
4
votes
1answer
61 views

Is it possible to manipulate the list of page templates?

After answering this question I wondered if it is possible to manipulate the dropdown list of possible page templates that's available when you edit a page. WP derives this list from the template ...
0
votes
1answer
26 views

Single Post Templates Doubt

While I was reading template hierarchy. The single post template file is used to render a single post. WordPress uses the following path: single-{post-type}-{slug}.php – (Since 4.4) First, WordPress ...
0
votes
2answers
30 views

Front-Page.php and Index.php

So I have a front-page.php that is shown when a visitor visits my site. I also want to create a blog page using my index.php file but I'm not sure what I need to do? Do I just create a new page ...
0
votes
1answer
62 views

Custom Post Type Archive - archive.php is present, but it is not being used

I have a custom post type called Treatment. From my understanding of WordPress, archive.php will always be used unless there is an archive-{posttype}.php. For some reason the archive page is instead ...
1
vote
1answer
86 views

Understanding the WordPress template hierarchy

I watched a lot of courses about Wordpress Development on Udemy. Also I've almost finished my "Wordpress Development" track on Teamtreehouse, but I can't understand one simple thing, because one ...
0
votes
0answers
41 views

Different template for different category in woocommece

I have two categories in woocommerce One is astrology and Other is numerology. Be default, Woocommerce call archive-product.php for category archive page, but I want to show different layout for each ...
0
votes
0answers
16 views

Wordpress Site Architecture Question

I have a multi site called 'quotes' the url of which looks like example.com/quotes/. I have some quotes under them like example.com/quotes/this-is-a-quote.html. I have some authors like ...
0
votes
0answers
32 views

Submit a Custom Post Type in WordPress from the Front End in Every Category

I want a front-end submission form in my WordPress website. Where this form should be available to each category? I want only two things in the form namely post title and post content. Is there ...
0
votes
1answer
28 views

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

Templates files for custom post type with custom tags

There is a task: Create a new post type (video) with its own post tags and tag page - separate from normal post. What I've done: // Create a new post type register_post_type('video', ...
0
votes
0answers
15 views

WPML doesn't recognize WordPress standard template

I am using the WPML translation tool which works for most of the sites of my theme with its page builder (theme "enfold"). However, I have some custom templates like date.php or category-$.php. These ...
3
votes
1answer
55 views

Load front-page.php from subfolder

My front-page.php works fine in the WordPress root folder. But I would like to put it in the page-templates subfolder. How do I make it load from there?
0
votes
0answers
26 views

Template Hierarchy Question

Why does this: http://site-name.com/?custom_taxonomy=producttype use taxonomy-custom_taxonomy.php while this: ...
0
votes
1answer
103 views

How to add dynamic content to posts page, archive, taxonomies, search, author, etc?

I am building a Wordpress plugin, it is kind of a page builder and I want to allow users to manually customize the page layout by adding content/shortcodes to any page within the "Template Hierarchy": ...
0
votes
3answers
18 views

How to determine the template loaded when you are not an Admin?

I have a page that displays differently based on what type of user I'm logged in as, and I can't figure out why. Specifically, if I'm logged in as an Admin, the page displays one way, but if I'm ...
10
votes
1answer
290 views

Custom taxonomy query broken after upgrade to 4.4

I just upgraded from 4.2 to 4.4 and now my taxonomy query returns empty. It has been working fine prior to the upgrade. I have registered a custom taxonomy named 'title', which is used by my custom ...
0
votes
0answers
48 views

Using base.php to keep the code DRY

Predefined anatomy of a theme according to Wordpress documentation is like this: index.php header.php footer.php single.php page.php Normally you get partial files everytime in index.php, ...
0
votes
0answers
18 views

Pages with given names don't show correctly, others do

my wordpress gone crazy lately. I recently created a website with about 10 sub-pages. Everything was good - possibly translation update caused the problem. Now the problem is as follows: I have a ...
0
votes
1answer
95 views

Custom post type and taxonomy permalinks - Structure

Been trying to get a nest of custom post type and taxonomy working (even took a look here) but couldn't get it working 100%. Here is the thing, I created a custom post type texturas_temp and a custom ...
0
votes
1answer
52 views

Simple way to get two language WP site

I am trying to make a site with two languages. I was looking for solution and didn't found a simple how-to answer. Also, I prefer not to use plugins when it is possible. What I'm trying to do: 1) To ...
0
votes
2answers
26 views

get_month_link uses what wordpress template?

I tried using archive.php and category.php but always index.php is used of my template. How can I customize what template file is used?
0
votes
1answer
50 views

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

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 ...
3
votes
2answers
92 views

Taxonomy Templates… by hierarchical level?

I'm wondering if there's a way to specify by filename different templates for different levels within a hierarchical taxonomy. I know about taxonomy-taxonomyname.php and taxonomy-taxonomyname-term.php ...
0
votes
0answers
23 views

Different templates for categories without plugins [duplicate]

Is it possible to show category pages using custom page templates without plugins? I want to give the administrator the ability to add new categories and select templates. Something like this: ...
1
vote
4answers
100 views

WordPress Template Hierarchy

Hi I have question about file names. If I have custom post type, and for template I can create for example single-portfolio.php and get content of portfolio posts into this file, but i need to get ...
1
vote
1answer
53 views

Categories overview that links to page displaying posts

I am trying to achieve the following A page that displays a series of categories with a title, description and an image When a category is clicked, all posts that belongs to that category gets ...
0
votes
1answer
70 views

Templates for hierarchical custom post type

I'm a bit confused with templates for custom post types defined as hierarchical. I've got a CPT set to hierarchical, not strictly in order to have a nested hierarchy, but so that they can be ordered ...
0
votes
0answers
76 views

Override template hierarchy

add_filter( 'template_include', 'my_callback' ); The above filter returns which template is there and what will be used, but i need to have all tries for finding template in template hierarchy. For ...
0
votes
2answers
123 views

Category-slug.php not being used

I have this category-newbie.php template in my theme. And I have the category "newbie" in categories, but it is not using newbie it is using the category.php EDIT:
0
votes
0answers
52 views

Wordpress using custom template for sub-sub-category and posts within

I have created a big common category "Catalog" ($category->cat_ID = 2). It contains a few sub-categories like "Series1", "Series2" and so on. Every sub-category contains a few sub-sub-categories ...
0
votes
0answers
38 views

Custom Post Type below second level mainmenu

I want to have the following structure in my website menu: Home | for Beginners | for Experts | Contact | | Reports (CPT) Reports (CPT) Jobs (CPT) Jobs ...
10
votes
3answers
1k 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
29 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
99 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
112 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
149 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
32 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
133 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 ...
3
votes
1answer
217 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
43 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
64 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
166 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
191 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
44 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
149 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
70 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
28 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 ...