You should be able to do this with the theme_templates
filter (see the get_page_templates()
function). What you need is a function that walks through the sub-directories and returns all the page templates. Then you hook it into that filter.
You could create a function based on get_post_templates()
, replacing the call to get_files()
with a function that scans subdirectories as well.
This approach is a bit unstable, maybe, because you’re copying core code that itself could change. Your code would be in the theme or plugin, but if the core version of get_post_templates()
changed, you’d want to update your version of it as well.
Related Posts:
- How to move page template files like page-{slug}.php to a sub-directory?
- Returning Variables back into a template
- Do I really need the div class entry?
- Single Page theme [closed]
- How to add “Template” option in page attributes panel?
- Can you create a custom page with content in the center already defined?
- What is the point of using the front-page.php template? [closed]
- How to automatically set a Template Page Name next to a page in menu screen such as WooCommerce pages, front page, or posts page in wordpress?
- The the_post_thumbnail without srcset?
- after_setup_theme always runs
- WordPress API Menu/Submenu Order
- What WP folder can I use to write files to?
- Why I can’t add a CSS style in this WordPress theme?
- Allow Shortcode in Theme Customizer
- Where to post/upload the new theme for WordPress theme repository
- register_sidebar ignores ‘id’ and ‘class’
- Display a different theme for not logged-in users
- Best practice (forward compatibility) for theme options
- Add colors to existing color palette without replacing it
- Single Page WordPress Theme – Using page templates
- add_theme_support( ‘custom-header’ ) does not add option menu in dashboard
- new theme permissions don’t allow me to edit
- Which theme foundry has clean coded themes, where code is poetry [closed]
- What page should I use for a contact form?
- Retrieve data using wpdb to use for customizer controls
- How can a Theme Contain no Header File or Footer File?
- Get list of months with posts
- Some translations do not work in my template class
- Does any theme support child theme?
- WordPress not registering Theme Customization Section
- How to remove a file included in parent theme with locate_template() via child theme?
- get_page_template returning nothing
- qTranslate with my own theme and settings
- Stylesheet not linking
- How to control layout of posts on page?
- Override template file i subfolders
- Theme Development for WordPress Multisite Installation
- Custom metabox for custom page template
- Include Parent functions.php in Child Theme functions.php
- create category on theme setup
- WordPress get_template_part() function not working
- Where am I doing wrong in my theme menu?
- Custom page template with custom fields
- How can my theme allow users to take advantage of advanced html tags in posts
- how to setup custom content structures
- How can I conditionally show different home page templates based on whether or not the user is logged in?
- how to get the post attachement image in full size?
- Widget Option is Missing
- Best way to develop a new theme on a live site, with new content? [closed]
- How do I make the most minimal vanilla theme possible with nothing but raw content?
- Can I Set Up Session in WordPress Custom Page
- If you were to start using a WordPress framework today, which one would you use? [closed]
- Set a featured image as a replacement to the header image
- Is it possible to have a theme that uses only one single page?
- Custom theme: How to call archive-post.php for viewing blog posts
- Theme Customizer not displaying saved values in wp_head (CSS)
- How can I hard code my sidebar?
- Thesis -style Navigation
- How can I wrap all blog posts image with
- Issue when posting updates/changes to wordress
- Valid SQL query not returning results
- StoreFront WordPress theme: How can i create a new Home page with Custom design same as template [closed]
- A post with a clear:both in its css destroy the theme design, and the sidebar is moved to the bottom
- Create theme for mobile phones and tablets only?
- Never actually adding the action? Or do I have to call the action?
- How to hide custom sidebar on mobile
- Custom theme template files
- Recommended sidebar / content widths
- Theme Checker Text Domain
- ACF get_sub_field ALT TAG in the repeater doesn’t show
- How to copy page/post from one theme to another?
- Not sure how to debug this npm install error. This is a wordpress theme that comes with a built-in gulp/webpack task automation [closed]
- Why front-page.php doesn’t show content of file instead shows loop
- How to make updatable custom WordPress theme?
- How can I access variables from theme in child theme? [closed]
- How can I not disable my theme when I want to upload a new version of it?
- Are paginated comments required for publishing Themes?
- How can I fix my theme header for my CSS stylesheet?
- Is hand coding required at all?
- Avoiding do_shortcode() loops
- Creating a Sub Category Template
- Correct was to customise theme using get_theme_mod in scripts
- WordPress Twenty-Fourteen: How to Remove Home Page Header Image from Other Pages
- Custom theme vs theme customization?
- how can I re-utilize and class on a child theme
- Modify comments_popup_link output
- How to figure out which wordpress theme a site was using?
- Incorrect search results in search.php – issue triggered by using `define(‘BodyID’, ‘search’); the_post();` in search.php
- Flexslider not working for my custom theme WordPress
- “No Data Received” error in Chrome every time i try to update the theme functions file
- Redirect to custom login page
- How to close open divs in post loop
- Display Today’s date outside the loop?
- Confused on loading page content
- php file child theme directory not overriding parent theme php file [duplicate]
- Loop inside page template not working
- Turning WordPress Into full-featured website?
- Why am I getting posts back when I shouldnt
- How to make a multilingual wordpress site to be translated one-to-one without much effort and without using translate?
- Full site editing templates folder vs block-templates