Changing how WordPress loads files can be very difficult and potentially destroy logic other plugins rely on. Instead, I usually make use of get_template_part()
in this case like so
single.php
<?php
get_template_part('singles/single', get_post_type());
And your files like
- singles/single-foo.php (for CPT foo)
- singles/single-bar.php (for CPT bar)
- singles/single.php (this is the default)
Related Posts:
- Do not show excerpt in post content
- Adding PHP code to single template in 2023 edition of WordPress theme
- how to add version of style.css in wordpress
- What is the role and history of the $content_width global variable?
- How to set thumbnail image for a (child) theme
- Add a page outside of the current theme?
- How to create a live demo page for a theme? [closed]
- Is it possible to stop a theme activation when a certain plugin is not activated
- add image size still doesn’t work even after regenerating thumbnails
- Using chunk theme from wordpress.com on my own host
- Duplicate and change a Theme Widget
- Best location for theme translation files
- Two Navigation Menus in Themes Produce the same menus?
- How can I customize the search results in Bones theme?
- How to develop a theme while having another show up
- When does WordPress wrap inline scripts in CDATA?
- Being asked to update a theme that I don’t have
- I want to run different WordPress websites under the same database
- Switch to other theme at URL
- How to go about pre generating css file with variables from theme options
- How to load a different theme for categories?
- How can I create an “excerpt” with text that won’t be displayed in the post itself?
- How to change sidebar per page?
- Add a series of checkboxes to theme options
- WordPress Theme Development Seemingly Awful Partitioning of Includes?
- Hide default “Recent Comments” Widget if there are no comments yet
- Theme Check warning wrong direcory for theme
- Static page not working
- How do I change the scan depth for page template files?
- Error defining a gutenberg block in a theme
- Looking for a fully customisable WP responsive theme to develop a small scale fiverr type site for voice artists [closed]
- Page dissapears when i click save
- Can’t resize logo in responsive theme?
- How to display message (with switch_theme hook) after deactivating My theme?
- Is wordpress big enough for my project [closed]
- Using twitter bootstrap in a theme
- How to get theme screenshot
- Theme doesn’t support shortcodes
- Icons not showing [closed]
- How do I understand which page of my theme is being loaded?
- What Generated Classes and IDs That Is Always Used On All Themes?
- Adding Sidebars in WordPress Theme
- Error 404 for JQuery import “jquery-1.10.2.min.map”
- Passing dynamic options from backend to frontend
- simplified explanation on child themes?
- Calling external Libraries in WordPress
- Using the same database on another Subdomain
- WP HTML Templates – Any way to get bloginfo() or the path to the theme folder?
- How to add more default colors?
- On a Https site, Css and Js Url are back to http after redirect the site
- Theme folder doesnt exist
- WordPress activate theme error $pagenow
- Increase content area width in TwentyFourteen [closed]
- Undefined variable error in theme option after updating theme [closed]
- Does Jetpack store comments in local database also? [closed]
- Comments not displaying after changing theme
- Theme Translation?
- Two column layout in WordPress?
- List of categories instead of dropdown menu selector in admin options
- WordPress doesn’t recognise created theme
- Query for all themes?
- How can I show some standard html code across any theme I install?
- Losing theme customization when switching from a theme to a child
- Problem of not changing the front and bottom of the Woodmart template by activating the really simple ssl pro plugin in WordPress
- Please help me clear my confusions about WordPress
- Why does an ad page open when I browse my websites’s wp-admin page?
- What is the correct way to set up a staging server and use github for version control?
- How do I use the default style for widget?
- WordPress fails to embed video URL on specific theme
- Unable to set social icons using Advance Portfolio Theme
- How can I theme or style the lost password page without a plugin?
- Custom homepage with recent blog posts
- Dynamic image for Jumbotron on WordPress Custom Theme
- How to implement theme option to change bootstrap 4 container from .container to .container-fluid
- how make wp include urls as https?
- how to costume title single page
- use a Thumbnail size in post
- Why does WordPress Editor Only Use Half the Box?
- 500 Internal Errors
- Installing Theme from uploaded file. Not uploaded theme?
- Where can I find a theme that has a big banner
- Strange Theme Error – parent style occasionally showing though child theme
- WordPress theme not updating in Other browsers
- WP-CLI wp theme install url PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature
- Site broken after deleting inactive themes [closed]
- Can i add wordpress editor to my custom theme option? [closed]
- Does WordPress provide themes_api function?
- Where do URI files come from?
- How to show tags in posts with a theme that does not do it
- Converting HTML5 to XHTML
- Best way to include pagination in a theme [closed]
- What happens to bespoke page template references on theme change?
- Stylesheet not being loaded? [closed]
- How to change the standard width of a page
- Where can I decide the number of posts to display on the blog index page?
- I need to disable responsive feature of a theme called Meet GavernWP [closed]
- Absolute and relative paths
- Get header/footer list for a theme
- Help!!! Old theme doesn’t load scripts and conflitcs with plugins
- How to remove pop up on website (css changes not visible)?