Questions tagged [template-hierarchy]

"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.

Filter by
Sorted by
Tagged with
0
votes
1answer
41 views

More than one search results page template for two searches on site

I have a site with two search fields, one on a page called 'blog' and one on a page called 'archive'. I am using <?php get_search_form(); ?> to call the forms. All of the sites posts are either ...
2
votes
0answers
27 views

Unable to include a template

On the home.php, which is in the same folder where style.css is kept I am try to call a template: <?php get_template_part( 'template-parts/content', 'home-default' ); ?> template-parts is a ...
0
votes
1answer
19 views

Can I assign a Folder for Post Formats, without it affecting WordPress' fallback/hierarchical system?

I have created a few Post Format Templates Files. format-aside and format-audio etc. At present, I am using <?php get_template_part (‘format’,get_post_format()) ;?> to call such Templates. In ...
0
votes
2answers
278 views

taxonomy - templates are not loading

I have registered taxonomy: $taxonomySetup = [ 'label' => __('Products catalog'), 'has_archive' => false, 'hierarchical' => true, 'rewrite' => [ 'slug' => __('...
0
votes
2answers
371 views

Custom Empty Results page for my Custom Post Type

I've been looking for the solution of this issue for a while but cannot find the correct answer. I'm developing a custom Knowledge Base plugin for my site, as requested by my boss. The around plugins ...
0
votes
1answer
791 views

Store Page Template Files in a Subfolder

I have number of legal documents of different formats / layout that I need to display on a Wordpress site, however I don't want to have them as individual page-pagename.php files in the root of the ...
0
votes
1answer
139 views

Template hierarchy override

One of the best way to override the default template hierarchy is to use the child theme and copy and paste the template file (from parent theme to the child theme) you want to override and change the ...
0
votes
1answer
275 views

Get link for taxonomy to show top-level terms

Is it possible to get a link for a taxonomy as such, not its individual terms? And to which page in the template hierarchy will this link point? Consider a hierarchical taxonomy called 'products'. ...
0
votes
1answer
572 views

URL Rewrite and Archive Template Files - Post Type vs. Taxonomy

I apologize if this is a difficult question to understand, but really it's a template hierarchy / rewrites question. I have set up a few rewrite rules that are successful, but I'm hoping that I can ...
0
votes
2answers
72 views

Avoid taxonomy-%term%.php if more than one taxonomy

I have a site with multiple custom taxonomies which are used for filtering posts. One of the taxonomies has a taxonomy-%term%.php template file. /?country=the_country shows the country taxonomy ...
0
votes
0answers
100 views

Templates for CPT not working

I am working on a project where I have created 3 CPT with some taxonomies. For each custom post type, I have created the following custom templates: single- archive- taxonomy- Taking as example the "...
0
votes
1answer
32 views

Will renaming a `content.php` file cause any problems?

I am currently creating a few templates for the various Blog formats, such as; 'Aside', 'Quote' and 'Gallery'. I see a lot of people create such Templates by naming such files as: content-aside....
0
votes
2answers
115 views

Different templates for each category level

I'm looking for a solution to dynamically create different templates for each category level. Category --Category ---Category ----Category I thought of something to get the taxonomy current level ...
0
votes
1answer
724 views

bbPress: modifying template for forum index

I'm reading up on the bbPress help pages to try and find out how to modify a template but with little success. I see that WP will look for the following theme files and use the top-most first: ...
0
votes
1answer
30 views

What Must to Display the “mysite.com/category” URL?

I have WordPress 4.8.1 running a Twenty Seventeen child theme. When I try to open the *mysite.com/category* URL I get an OOPS! THAT PAGE CAN’T BE FOUND message. Is this a normal behavior? Can be ...
0
votes
1answer
869 views

Creating page & post templates without template file

Usually if you want to customise a post (generic: ie all) type in WordPress you would create a custom page template for it ie, following the template hierarchy, a page will be customised based on it's ...
1
vote
1answer
174 views

How do I check if the user is on a taxonomy term parent, child or grandchild page?

I have a custom taxonomy: product_range and it has 3 levels: (1 - Parent) Product (2 - Child) Product Category (3 - Grandchild) Product Sub Category I need to display different content depending ...
0
votes
1answer
444 views

Wordpress Custom Post Type - Post Attribute: Template. Template shows up and saves on the back end, but the default theme file is being rendered

Edit: Now I've found that this is Hybrid Core, and apparently the template hierarchy is different. I still haven't solved my problem below though. In addition to the title. My thinking is that if I ...
0
votes
2answers
22 views

Custom TaxonomyTemplate

I have created a custom taxonomy brands and added some brands to various posts. I also created a file called taxonomy-brands.php and it seems to be working fine. If I visit www.domain.com/brands/...
0
votes
1answer
76 views

Templates & CSS - Proper Programming Practice?

I've worked with WP/html/css casually for a long while but never dug deep before, I have a few questions about good practices. My Background - totally skip this if uninterested I've been left ...
0
votes
2answers
219 views

Single taxonomy for different custom post types

I have two custom post types: books and authors. Both of them have attached a custom taxonomy - genres. How would I display the books in the fiction genre? What would be the URL used and the name ...
0
votes
2answers
68 views

Letting wordpress decide what template and page to use based on condition

I am really not sure how / what to ask, but ill try my best... Can I some how tell Wordpress (in the index.php file maybe): If A Then load page Y with his matching template (which you always know so ...
1
vote
1answer
737 views

When a link doesn't exist, how to tell Wordpress what to do? (404 Error Page)

If you click any link that doesn't exist in my main site site, for example this link, i expect the WordPress to use the default index.php file that has this loop inside it: <div class="main col &...
0
votes
1answer
576 views

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

Which template(s) to override to use a different sidebar for blog, single posts, categories, blog archive?

I'm setting up a News page as my site blog, and I want it to have a different sidebar from the one already used on the rest of the site. So far, I've managed to add a new widget area for my sidebar ...
1
vote
1answer
550 views

Override template file i subfolders

What is the correct way to override theme template files in subfolders with a child theme? I wan't to override a theme template file with the following path: /components/theme-header/ Do I have to ...
0
votes
0answers
631 views

Archive or taxonomy pages not working for custom post type

I am trying to built archive templates for my theme , I am using plugin wp-job-manager which gives me following custom post type & taxonomies custom post type : job_listing 1st custom ...
1
vote
2answers
64 views

Trying to manage templates on a blog with lots of custom taxonomies

In my most recent project, I'm dealing with a website that included dozens of custom taxonomies, couple of post types, content, etc. and required different templates for different authors or tags. ...
0
votes
2answers
2k views

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

Manipulating show_on_front, page_on_front, page_for_posts and template hierarchy

I need to overwrite the show_on_front, page_on_front, page_for_posts options values for some reasons. I am setting show_on_front to 'page' and the other both to two different page id. If I change ...
1
vote
0answers
41 views

Wordpress Doesn't Generate Taxonomy Archive

I have a post type named 'publication' and a taxonomy named 'area'. For some reason, I cannot seem to get Wordpress to generate a taxonomy archive for the terms of 'area' from my custom taxonomy.php ...
2
votes
1answer
612 views

Rewrite Custom Post Type URL slug

Hello StackExchange WP_development :) I am in a bit of a pickle with this one and i certainly hope you can consult me further. Im helping out with a WordPress site that is build as a "singlesite". ...
5
votes
2answers
36k views

How to override WooCommerce template files?

I was trying to customize the shop page (adding widget area to the page). Is there any way or plugin to help me do so? I created a page-shop.php however no changes were seen.
2
votes
3answers
7k views

Multiple Single Post templates

I have a custom post type called funerals and a page the lists all the posts part of that custom post type. To display a single page I create a file called single-funerals.php and that all works well....
0
votes
1answer
210 views

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, ...
1
vote
3answers
637 views

How to Handle CSS for Multiple Header header.php Files?

So, I'm building a new theme based on Underscores. So far, I've managed to get ACF Pro to call different header files from a dropdwon selction in the Options page but, now I am faced with the task of ...
0
votes
1answer
142 views

All top-level pages are using index.php as template

On my site, all top-level pages (i.e. mydomain.com/example-page as opposed to mydomain.com/parent/example-page) will only use index.php as their template. They won't use page.php, they won't use ...
1
vote
2answers
8k views

Different template for subcategories

I would like to have a different template for categories and subcategories The categories template is set in categories.php is it somehow possible to load the subcategories template from subcategories....
0
votes
0answers
31 views

Wordpress Subcategory template [duplicate]

First of all on this forum i found a lot of sollutions that got really close. But i wasn't able to solve my issue completely I structured my website using category-subcategoriy- posts. Every once in ...
0
votes
0answers
256 views

How can I modify wp_get_archives() to not use archive.php template?

If using wp_get_archives() or another query to display a year/month archive, the links for the months requires the archive.php template. Is there a function which can enable a different template to ...
0
votes
0answers
82 views

Page has no template

I've created a custom search for my custom posts, using the accepted answer from Creating a search form for custom fields. However, I'm struggling with the resulting page - I need to conditionally ...
1
vote
3answers
2k views

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

How to display custom post type?

I created custom post type called book. I'm trying to make a template in my theme so when I use this template for any page in my theme instead of fetching normal post type (I mean my posts) it fetches ...
0
votes
2answers
40 views

how to force tag page layout to use same as search layout?

I have remarked that when clicking on a tag I have a list of posts displayed differently that when I use search box. How to force tag page layout to use same as search layout for any template ?
0
votes
1answer
861 views

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

I have this hierarchical Woocommerce products categories: Parent X - child X1 - child X2 Parent Y - child Y1 - child Y2 I have products in each sub category and no product have more ...
0
votes
1answer
548 views

Is there a template file to list all terms of a given custom taxonomy?

Suppose we registered the composers and the interprets custom taxonomies. The composers taxonomy could have the following terms: Wolfgang Amadeus Mozart Ludwig van Beethoven Richard Wagner The ...
0
votes
2answers
68 views

How to determine top level template file in functions.php? [duplicate]

I am using index.php for my home page, and I am using single.php for my single post page. In my functions.php how can I determine if I am in index.php or single.php?
0
votes
2answers
233 views

Different taxonomy.php for different custom post types

I have taxonomy.php template file for post_type "posts" but I'd like to use another taxonomy.php but just use/apply it to a custom post type. Is this somehow possible to make another taxonomy.php file ...
0
votes
3answers
1k views

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-...
5
votes
2answers
843 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 ...