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
14 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 ...
0
votes
0answers
19 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
26 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
0answers
14 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
35 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
39 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 ...
1
vote
1answer
101 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-...
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
36 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
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
51 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 ...
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'...
0
votes
0answers
91 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 ...
2
votes
2answers
678 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
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 ...
0
votes
2answers
51 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 '...
1
vote
3answers
574 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 ...
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
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 ...
0
votes
1answer
106 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 ...
3
votes
1answer
186 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
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
3answers
849 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
1answer
251 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
0answers
218 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
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
1answer
39 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 ...
1
vote
1answer
250 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
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....
0
votes
1answer
19 views

Static page won't identify template

I have two pages, one working correctly and one broken. The first is called Calendar and it has an ID of 34. I created a page template called page-34.php and wrote some custom code, and when I load ...
2
votes
2answers
4k 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
1answer
34 views

inserting content of 1 Post to in another with a template hierarchy

I have a page template I use for landing pages for various ad campaigns. The template uses custom fields for things like headlines and other shorter pieces of content within the page. However the ...
0
votes
1answer
72 views

Templating advice sub posts of a CTP

Im looking for advice to generate a few 'default' post templates. Currently this is the setup for the CPT 'projects'. We generate subpages and select the main post type as parent. This works well to ...
2
votes
1answer
101 views

Any tag pagination page (except the 1st page) loads index.php template instead of tag.php

Created my first custom theme from scratch and I'm trying to do a listing of all posts with the same tag. In tag.php I display all posts with that specific tag via a WP_Query and I'm trying to ...
2
votes
1answer
87 views

How to apply a custom template for posts by default?

I have created a custom template. Now how do I apply my template instead of single.php for posts by default? I want to do this so that theme upgrade doesn't replace by custom template.
0
votes
0answers
28 views

which template should I use for single category post?

I have a category 'c program'. I can show this category using category.php template file. I have a post like 'First C program' under 'c program' category. So I want to use another template file for ...
0
votes
0answers
30 views

custom post template not getting picked for posts with Unicode title

We have a custom post type called support. And we have created a template for it as single-support.php. The problem is when we crate a new post with English slug it works fine: eg. www.mywebsite.com/...
0
votes
1answer
22 views

Specific template for subcategory of custom taxomy

I've a custom post type that I manage with a custom taxonomy. I've made a template: taxonomy-brand.php, to show the top level categories of the taxonomy. Now I'd need to show the subcategories of each ...
0
votes
1answer
28 views

My WordPress installation doesn't load correct template

For whatever reason there are some odd things going on with my theme, I feel like it's such a fickle install and some times I wonder how it runs. Anyway, I'm having a few different post types, ...
0
votes
1answer
69 views

How do I control what template is shown based upon Taxonomy Term?

I am building a business directory and will give some context and then have 2 questions at the end. The development URL is: http://svcta.lainternet.biz/ The website I am rebuilding is: https://www....
1
vote
1answer
214 views

Inheritance of parent theme plugin files in a child theme

I have parent theme that has some plugins in it, those plugins are added as a dependency. In the child theme, I want to override some of the files that belong to those plugins, but it looks like ...
1
vote
1answer
105 views

Load custom template for specific GET parameter

How is it possible to load a different template file when a specific GET parameter is set? I want to create an account details page. So when the account parameter is set there should be loaded for ...
0
votes
1answer
34 views

Selected template is not respected for home page in Wordpress

I have a theme, and I made two new files for different templates. I can now pick these templates when I post a page: This works perfectly when I go to any subpage. I made a page called Test, selected ...
1
vote
0answers
98 views

How to Rewrite Taxonomy URL to Include the Post Type as the Second Segment of the URL?

I have a custom taxonomy which is called locations which is assigned to post types which are post and events. What I am trying to figure out is how to rewrite the URL of the terms to also include the ...
3
votes
1answer
318 views

Is it possible to have an index page for taxonomy term for each custom post type it is assigned to?

I currently have a setup where I have a custom taxonomy that is link to the Wordpress post post type and another custom post type. Since the custom taxonomy is assigned to the two post types ...

1
2 3 4 5