WordPress: How to auto include header and footer for every template in wordpress?

Put following code in functions.php to enable auto header, footer include in every custom template you will create.

add_filter( 'template_include', function( $template ) {

    get_header();
    include $template;
    get_footer();

    return FALSE;
});

 

Leave a Reply

Your email address will not be published. Required fields are marked *