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
15 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, ...
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 ...
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
20 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
58 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
98 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
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
1answer
39 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
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
275 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
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 ...
0
votes
1answer
75 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 ...
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....
0
votes
1answer
43 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 ...
0
votes
2answers
283 views

taxonomy - templates are not loading

I have registered taxonomy: $taxonomySetup = [ 'label' => __('Products catalog'), 'has_archive' => false, 'hierarchical' => true, 'rewrite' => [ 'slug' => __('...
0
votes
1answer
292 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
594 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
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
2answers
125 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
755 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
933 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
459 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
23 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
2answers
224 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 ...
0
votes
1answer
127 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 ...
0
votes
0answers
635 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 ...
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
1answer
146 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 ...
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
257 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 ...
0
votes
1answer
550 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
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
2answers
105 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 ...
0
votes
1answer
81 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
56 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
191 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 ...
0
votes
1answer
411 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', array('...
0
votes
1answer
950 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
1answer
937 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
224 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 ...
0
votes
0answers
89 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
413 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
1answer
44 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 ...