Looking at wp-includes/template-loader.php
… there seems to be a way:
if ( $template = apply_filters( 'template_include', $template ) )
include( $template );
You could hook into that filter, handle the including in a callback function and return FALSE
.
Sample code, not tested:
add_filter( 'template_include', function( $template ) {
get_header();
include $template;
get_footer();
return FALSE;
});
Related Posts:
- How can a Theme Contain no Header File or Footer File?
- Changing footer depending on URL (poli language site)
- How to reuse parts of WordPress site e.g. header, footer, part of header for multiple WordPress sites?
- wp_redirect() – headers already sent
- How can I get wp_head() as a string instead of echoing it?
- Template Hierarchy for get_header()
- How to remove header images from all pages except the home page? skeleton theme
- Add social icons in a theme through custom admin menu
- Fatal error: Call to undefined function get_header()
- How can I customize wp_footer, where is the code that controls what this function does?
- How do the default themes reference style.css?
- How to remove the header from all pages except home?
- Create wordpress header with custom logo in between the menu splitting the menu into two equal parts [closed]
- Edit footer via customizer
- WordPress Unite Theme: Footer isn’t sticking [closed]
- How to remove header image in Twenty Eleven theme?
- How to create a fixed header and scrolling content area
- Dynamic menu links after header title
- How to change footer or for different kinds of users in wordpress?
- Second menu has the first menu ID
- Changing sidebar.php and footer.php depending on URL
- header, stylesheet not being read
- Why is the `if else` not working?
- How to add cropped custom header image?
- How do you remove header sitewide from mobile only?
- how to change footer content for certain pages only
- remove_action(‘genesis_header’,’genesis_do_header’) hook not working
- Change header image on a particular page
- Dynamic meta description
- get_footer not working boilerplate theme
- How to create full header but keep content narrow
- Display Search Result Count
- theme path in javascript file
- Minimum Template Files for Theme Development
- Are content.php and content-single.php the same?
- What is the right way to include a wp-admin file in your theme?
- Theme Check gives: Required: This theme doesn’t seem to display tags?
- Is it possible to use line break in theme description?
- Override Current Theme Setting in wp_config.php
- modify a output of a widget
- How do I “unhook” / de-register jQuery so that it’s not called as part of wp_footer();?
- WP Gutenberg custom block – generate theme colors from SASS and use them in the inspector and php callback
- Which is the simplest theme for WordPress to use it as your base?
- Is tag default in WordPress?
- Getting jquery to work with custom theme
- How to retrieve an image from a post and display it before excerpt of a post? [duplicate]
- Why does WP recommend against custom favicon functionality in themes?
- What’s the best action to use when you want to do something only once per theme setup?
- Excluding a page with a certain name from wp_page_menu
- Widgets with groups / sub widgets? Widget in a widget?
- Avada resources still loading from localhost after database migration [closed]
- No Appearance –> Header menu
- How do I create a custom partial / template?
- Internationalization and functions that use it
- How should I be handling my theme version numbering?
- Update Custom Theme Version
- What can I use for small text when converting to WordPress?
- How to i style the elements from the TinyMCE
- Integrate WooCommerce theme with a WordPress theme [closed]
- Automated Footer information
- How do you use WordPress for a website that’s not in a blog format?
- How to develop a menu like wwe.com?
- Add tags to pages
- How to escape multiple attribute at once in WordPress?
- Override plugin option by with a custom theme
- Review site using WordPress
- How to create query to get top 3 sticky/latest posts
- Fatal error: Class ‘ZipArchive’ not found
- Is it possible to determine when user is at “Media > Add New” vs “Post > Add an Image”
- What happens if a theme is no longer supported?
- Running a function on post update with new post meta
- Check if( selected() )
- Modify available templates (in dropdown)
- Change WordPress Resource URL
- Adding content inside the anchor tags within WordPress main nav
- Sample Theme Options page for Multisite – what to consider
- Search Form Not Working
- My contact form – I’ve changed the source code but the changes are not being applied
- Theme calling page.php instead of home.php
- Open portfolio image in light box
- Dot “.” in option value foobars save options function
- style variations hurt the editing performance
- How to properly use AWS SES for a contact form?
- No templates for condition page.php Elementor
- Theme does not allow shortcodes
- fetch all post from wp multisite network and sort all the post in descending order on the basis of “Created by ” term
- What is the best practice workflow for new website overhaul and keeping current SEO ranking? [closed]
- Providing updates to your WordPress theme
- Mutlisite in wordpress is not working
- add_theme_page is not working
- How to check if a certain theme option settings has already been set
- All post ids are the same after this query but rewind_posts() does not seem to work here?
- How can I tell WP which file to load by default in Appearance > Editor?
- How to resize video lightbox popup in wordpress? [closed]
- How can I get rid of the distance when I’m using list-style-type: none? [closed]
- Extracting Distance from FacetWP Proximity Function to Display in WordPress Template
- Theme now uses require.js and enqueue script no longer works
- WP site makes mobile browser crash for high memory usage
- Fatal error: Call to undefined function the_posts_navigation()
- Return the_content() with custom div class for a subset of posts