I think that you’re over engineering the problem here. If all you need to do is get the appropriate archive template, whatever that may be, then use get_archive_template()
although you may need to use the {$type}_template_hierarchy
filter on get_query_template()
to add index.php to the possible results.
Related Posts:
- Page Templates Used in Custom Post Type
- Loading partial templates with AJAX/PJAX
- Templates & CSS – Proper Programming Practice?
- index.php template is used instead of blog page
- Load template file without a post type
- How to apply a custom template for posts by default?
- Which php file lists all the post of a category
- Template tags for Buddypress
- Unable to include a template
- What should I put on my index.php?
- When a link doesn’t exist, how to tell WordPress what to do? (404 Error Page)
- New custom nev not working [closed]
- Is there a way to set different post templates for parent posts and child posts in the same post type?
- One of my pages uses the archive.php template only. Why?
- Having trouble with Template hierarchy. I Need to create a set of pages that drill down from states to specific locations
- Custom templates vs page-slug
- Understanding the Template hierarchy
- How does WordPress choose archive type template?
- Use one template only for custom post type archives?
- get_month_link uses what wordpress template?
- Use meta boxes inside an archive page template for Woocommerce
- Differentiation between index.php and page.php
- Single-page.php template file name not shown
- Can I assign a Folder for Post Formats, without it affecting WordPress’ fallback/hierarchical system?
- How to display custom post type?
- wp_list_authors() returning the wrong member url
- Assigning custom page templates to a static blog page
- Archive-custome_post.php template not working
- Organize template parts and page templates in folders in regards of template hierarchy
- Help Understanding Template Hierarchy
- What filter or action hook to use in order to load some code before the template begins printing in BuddyPress? [closed]
- Conditional template tag for buddypress pages
- Is it possible to set archive.php instead of index.php to display blog?
- How do I custom a page that doesn’t exist in the page list?
- User role templates
- Assign template to custom page type?
- How can I make custom page templates work on child theme?
- I want to display all related posts for a selected tag in WordPress
- Which template(s) to override to use a different sidebar for blog, single posts, categories, blog archive?
- Single Post Templates Doubt
- Show a custom template, no matter the page being viewed, if the user is not logged in
- Unload templates; disable parent Template Parts using only “theme.json”
- How to use Class
in Java? - Is there any way to use get_template_part() with folders?
- Can’t get a custom template taxonomy page to display
- How to edit contents of dynamic_sidebar()?
- A special single page templates for posts under a category and all its child category
- How do I override template-tags.php in twentyseventeen theme
- roots child theme can’t override header.php
- When calling wp_title(), do you have to create some kind of “title.php” file?
- Stream Video Player does not work with do_shortcode()?
- How does wordpress blocks?
- Subpage template
- How To Create WooCommerce Custom Template For Specific Product?
- Programatically create a page
- Use PHP templates as blocks
- Directly using pure JWPlayer JS (but NOT WP Plugin)
- Login page theming?
- I want to add a custom “all posts by author” by authors name. How?
- Redirect template based on permalink rather than $wp_query
- How to duplicate a page template but make minor changes to the header?
- get_template_directory() still returning path to previous theme
- What’s the purpose of $wp_did_header?
- Trying to display short code content in template file with do_shortcode()
- Unable to add template to page set as Posts page in WP V 4.6.1
- How to use index.php as a template for archives?
- How to customize WooCommerce templates to avoid override upon update [closed]
- single.php with different look by category
- Creating new content types (Pages, posts, testimonials, tigers, oh my!)
- Dynamically Insert Image Into Stylesheet
- Way to use one template but be able to call different top graphics?
- Differnt page template for page 2 of blog feed
- How to implement my custom development multiple PHP page work into WordPress?
- Create template for just a print
- dynamic_sidebar() stopped working
- Index template always follows page_template() template?
- Sending email for the custom form in WordPress
- How to use another file instead of home.php
- Can i exclude certain page templates for a specific role?
- Using a specific template for front page only
- WordPress hierarchy clarification, does post_type_archive take precedence over taxonomy-term archive?
- Set og:image programmatically in custom single post with external images
- Locating the HTML piece of code in wordpress
- Custom Template doesn’t output result when set as homepage
- Theme keeps going to default files [closed]
- How can I show contents of a template part inside of another page?
- How to serve a amp template
- Single page applications with WordPress: routes and templates
- Inserting javascript file into theme template?
- Creating custom post-listing templates in twentyseventeen child theme
- Submit form to another template (ugly url)
- Using file outside of template hierarchy for Twitter sign in authentication
- List all pages using a specific template on a page
- Duplicated Template Does Not Load the Same as the Original Template File?
- Use different archive template for plugin
- Blog template PHP [closed]
- load_textdomain won’t load my .mo file
- files disappearing from template
- why does blog page ignore template [closed]
- html blog template to wordpress template