Answers for "Replace header template from plugin"

PHP
0

Replace header template from plugin

function header_override () {
    // $template = locate_template('header.php');

    // load_template(plugin_dir_path( __FILE__ ) . 'templates/header.php');
    // print_r($template);

    if ( $overridden_template = locate_template( 'header.php' ) ) {
        load_template( $overridden_template );
    }else{
        load_template(plugin_dir_path( __FILE__ ) . 'templates/header.php');
    }
}
add_action('template_include', 'header_override');


function new_header_output() {
    remove_action( 'get_header', 'header_output', 20);
    load_template(plugin_dir_path( __FILE__ ) . 'templates/header.php');
}
add_action('get_header', 'new_header_output');


function action_function_name_391( $name, $args ){
    print_r("custom header");
}
add_action( 'get_header', 'action_function_name_391', 10, 2 );
Posted by: Guest on August-15-2021

Code answers related to "Replace header template from plugin"

Browse Popular Code Answers by Language