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
0answers
13 views

Force wordpress to load empty categories

If I don't have posts in a category, the category.php file won't load. This is a problem, because whoever built this custom template, used post categories to display woocommerce prodcuts (don't ask ...
2
votes
2answers
557 views

Where to put my global functions?

I currently have a global function in my functions.php file ein_error_log($message) { //push out $message to file... } But I want to start using it in my MU-Plugin directory and it doesn't ...
0
votes
1answer
914 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 ...
1
vote
2answers
931 views

Taxonomy landing pages

I like to create a landing page for my custom taxonomies. Right now ive created three custom taxonomies /country/[terms] /person/[terms] /interrests/[terms] i like to create a listing page for each ...
0
votes
1answer
694 views

404 on child page template

I have a page called portfolio and I have created several child pages for it like Video page, audio page etc … I also created custom page template for portfolio and named its file portfolio-template-...
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 ...
0
votes
0answers
18 views

For custom templates, is it better to use `template_include` or `type_template`?

I saw a lot of questions about including custom views in Wordpress (I mean custom templates). There were many answers. Some people recommend using template_include and others recommend using ...
0
votes
0answers
18 views

Loading a custom template file for plugin single page

I have had no end of trouble trying to load custom template files I create in plugins. I have got to the point where one is loading, but its like loading inside another template, if that makes sense. ...
0
votes
1answer
823 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 ...
0
votes
1answer
21 views

How to load parent theme template parts in child theme

I was wondering how can I load parent theme template parts through child theme after customization. I have created three custom template for my theme and they are working fine. But now I want to load ...
0
votes
3answers
778 views

page-{slug} not loaded in custom theme

I'm working on a custom template for WordPress. I've created some page and then created the relative page-{slug}.php (example page-careers.php) that are supposed to be loaded from WordPress when the ...
0
votes
0answers
13 views

How to make Wordpress automatically load a page-$slug custom template, according to the URL?

I was wondering if there is a way to make Wordpress redirect to a certain custom page template, according to some "routing" convention. For instance, I've added a template file called page-docs.php, ...
1
vote
1answer
25 views

Rewrite URL for only archive page (custom post type)

There is a few Q/A about custom post URL rewrite but I haven't found any simple answer to what I'm trying to achieve. My CTP is "event" and I have the current page structure that I want to preserve: ...
1
vote
1answer
32 views

Hook to override title, image and content

I'm creating a custom post type with a plugin, and I want to show my cpt title/thumbnail/content... etc using hooks (assuming it's better than loading a custom template). But themes are showing title/...
1
vote
0answers
27 views

How to show single category archive

I have created the category.php template file for my wordpress custom theme. I put inside it the loop and the markup needed to disply my single category layout. I'm facing the issue that if the url is ...
0
votes
1answer
547 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 ...
2
votes
1answer
477 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 ...
1
vote
1answer
67 views

Display Categories, Sub-categories, and Sub-sub-categories on separate pages

I am building a FAQ section in our mobile site which I would like to have the following hierarchy: Category > Sub-category > Sub-sub-category > Article I would like the category list and each sub-...
4
votes
2answers
35k 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.
0
votes
0answers
14 views

Removed slug from custom post type URLs page template issues

I use this function Remove slug from custom post type post URLs to remove slug from custom post type URLs .. but now I have issues... page.php is not working ... so now my pages with default template ...
3
votes
1answer
34 views

Archive page showing nothing - issue with WordPress Hierarchy?

I'm building a theme and I've found it all pretty simple and straightforward. However, I can't figure out why I have a totally blank page for my archive WordPress blog posts? I understand the ...
0
votes
1answer
417 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
15 views

How to prevent the search results page from using my single-{post-type}.php template

I have created a custom post type which uses single-{post-type}.php to display when ever a page of that particular post-type is viewed and this works fine. When the search form is submitted the ...
0
votes
0answers
16 views

Restricting page templates by blog_id in multisite network

TL:DR; Is it possible to restrict page templates to a certain site within a multisite network? (Using something like get_current_blog_id for e.g) More details I’m building out several websites that ...
0
votes
0answers
22 views

User role templates

I'm currently using the author.php template to display a frontend archive of users' posts from all roles. I've now created a new user role ("trainer") that needs to have a completely different ...
0
votes
1answer
46 views

Assign template to custom page type?

I have created a custom page type (using post state) for my project, so that I can select the page in the Reading settings like you do for page for posts and also for the home page. This is all ...
2
votes
2answers
3k views

WooCommerce Template overriding not working with woocommerce.php

I am creating a custom theme with my own HTML. I am trying to override woocommerce template. I have created a template named with woocommerce.php but it still shows template with default structure. I ...
0
votes
0answers
48 views

How can I include custom folder for the native hierarchy?

I want to put all the template files in certain directory in child theme. I also want to get the benefit of native wp hierarchy. I don't want to write code outside of that certain directory, and I don'...
1
vote
2answers
1k 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
82 views

Overriding the template files using a plugin for all themes

I believe these are the common filters to use when overriding a template template_include single_template page_template archive_template The works but it seem that they are theme depended. I am ...
0
votes
1answer
759 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
0answers
22 views

Media item permalink goes to source file instead of attachment.php

My Media Library permalinks are bringing up the source items directly and seem to be ignoring my attachment.php file. This is happening for both attached and unattached files. I'm trying to use ...
1
vote
3answers
502 views

Wordpress Theme Development: How to redirect templates the right way?

I'm developing a theme for WordPress. I have a doubt about templates redirect. For example, I have a theme that have the front-page.php template and I don't use the index.php template. What I should ...
0
votes
2answers
48 views

Single-page.php template file name not shown

I am developing a theme and I noticed that get_post_meta($post->ID, '_wp_page_template', true); returns 'static-page.php' (as expected) when queried on static pages but returns nothing (expected '...
2
votes
2answers
64 views

Load template file without a post type

Is there a way of loading a template file without having a post? I'm loading set of data via an API. Set up my index page but having a brain freeze with single template files as these posts are not in ...
0
votes
1answer
124 views

Wordpress 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
1answer
98 views

Template files not working for archives and categories

I added category-news.php template file to the theme directory but it doesn't apply the template of the category but instead to the index.php file. category-slug.php is the highest level of the ...
0
votes
1answer
36 views

BuddyPress : how can I call the template Wordpress would have chosen (template hierarchy)?

playing with BuddyPress here ! I made some new user profile pages, and when I display the content, I want to make a new posts query, and display the loop. Thing is, I want to display that loop using ...
3
votes
1answer
167 views

How to use same theme template for multiple taxonomy terms?

How would I use the same template file for, say three specific taxonomy terms but not the remaining three? I know taxonomy-taxname.php is the file for all terms I know taxonomy-taxname-termname.php ...
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 ...
4
votes
3answers
18k views

Is there a default template file for child pages / subpages?

This seems like a very simple question. I'm looking for something like sub-page.php or page-child.php where I can do some different things on the child pages of my theme. They are different enough ...
0
votes
2answers
31 views

How can I make custom page templates work on child theme?

I have created a page template called concert.php under page-templates directory with the following content: <?php /* Template Name: Concert*/ add_body_classes('page_concert'); /* Custom ...
0
votes
1answer
225 views

Custom Archive Template for Multiple Categories

I want to create a custom archive template for two post categories. One of my categories is events, and the other one is courses (I have more). I already have a custom template for events (category-...
0
votes
1answer
21 views

Custom Post Type Template Hierarchy - Single post template

I have registered a custom post type and I am trying to make posts of that type display in a specific template file but can't figure out what to name my template file in order for the posts to use it. ...
1
vote
1answer
238 views

How To Pass Current Post Type ID from Single Template To Custom Page Template

Having a Custoom Post Type called movies, I am able to get the current Post ID in my single-movies.php template. Now can you please let me know how I can pass this post ID from the single template to ...
1
vote
1answer
21 views

redirect automatic page that serves custom posttype content

I registered blog as a custom post type. This content is queried on the page page-actueel-blog. But mydomain.com/blog also serves content (by default titles are queried). I don't want visitors to ...
1
vote
0answers
208 views

Custom post type showing index.php

I am creating a theme and I have created a new Custom Post Type (CPT) called 'Custom Plugins'. I am trying to get this CPT to use its own template. I have created a single-custom-plugin.php - it doesn'...
1
vote
1answer
37 views

How to overwrite core/libraries/vendor template with child theme

A theme that I am using is overwriting the woocommerce templates with files in theme/core/libraries/vendor/woocommerce/templates folder. I tried to overwrite some minor stuff by following the best ...
4
votes
2answers
1k views

Taxonomy Templates… by hierarchical level?

Is there a way to use different templates for different levels within a hierarchical taxonomy, specified by filename. I know about taxonomy-taxonomyname.php and taxonomy-taxonomyname-term.php ...
1
vote
1answer
18 views

Having trouble with Template hierarchy. I Need to create a set of pages that drill down from states to specific locations

I am creating an interactive set of pages that needs to be very easy to navigate, as the audience skews older. Walking through the flow The user will start at a page, that lists all of the (US) states....

1
2 3 4 5