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”
- order archive page by title in wp twenty twenty-four template
- How to use Class
in Java? - Get name of the current template file
- How do you find out which template page is serving the current page?
- How to change the default registration email ? (plugin and/or non-plugin)
- How do I get the size of an attachment file?
- Is there any way to use get_template_part() with folders?
- single-{$post_type}-{slug}.php for custom post types
- Adding Page Attributes Metabox and Page Templates to the Posts Edit Page?
- How can i change email template for new user
- Any advantage to using get_header() over include(‘header.php’)?
- Enable page templates. How?
- Is it possible to override the result of get_template_part()?
- Use [embed] filter in template files
- What’s the purpose of the paged.php file?
- How do you access the Product Short Description in a WooCommerce email template? [closed]
- Prevent comments_template() to load comments.php
- Is there a way to list all used/unused WP templates?
- Page editor missing Templates drop down
- Print WordPress template filename(s) for debugging
- How to force TinyMCE in WordPress to replace newlines with tags and not with
- How to find the posts page (home page) programatically
- WooCommerce: Change template for single product page
- Can’t get a custom template taxonomy page to display
- View WordPress page template usage (or unused)
- How to edit contents of dynamic_sidebar()?
- How to check if a shortcode exists?
- Where is get_header(‘shop’) file in Woocommerce templates
- Custom templates folder
- What is the link to my default “archive” page?
- How to get slug of current category in taxonomy template?
- How to show a under construction page for a domain but still be able to work on index.php?
- Change the name of the ‘Default Template’
- Customizing get_the_excerpt() to specific length and “Read More” output.
- How to Rename a Template File?
- Template for specific post of custom post type
- get page templates
- Echoing Elementor page content in template, but it doesn’t get styles and some widgets are missing
- Using WordPress templating for HTML emails
- Is it possible to manipulate the list of page templates?
- WP frontend output of custom textarea fields not respecting line breaks. In admin it’s OK
- How do you check if a WordPress template file exist?
- Loading custom page template via plugin
- Multiple Single Post templates
- Taxonomy Templates… by hierarchical level?
- Load entire NextGEN gallery from single thumbnail?
- I put my blog on a subpage, how do I get page title?
- A special single page templates for posts under a category and all its child category
- Custom reset password template after forgot password request
- Outputting Canonical Resource URLs Across a Multisite Network?
- Gravity Forms Custom Templates [closed]
- Child Theme: how to override variables?
- How do I get the URL of a specific size featured image?
- Where to store some per-template preferences?
- add/apend templates ‘transparently’ via plugin to currently active theme or child theme?
- stop blog page from using index.php?
- How can I modify the default reset (lost) password email text?
- Different templates for parent and children categories/taxonomies