replace header template from plugin

Solutions on MaxInterview for replace header template from plugin by the best coders in the world

showing results for - "replace header template from plugin"
Edoardo
28 Aug 2016
1function header_override () {
2    // $template = locate_template('header.php');
3
4    // load_template(plugin_dir_path( __FILE__ ) . 'templates/header.php');
5    // print_r($template);
6
7    if ( $overridden_template = locate_template( 'header.php' ) ) {
8        load_template( $overridden_template );
9    }else{
10        load_template(plugin_dir_path( __FILE__ ) . 'templates/header.php');
11    }
12}
13add_action('template_include', 'header_override');
14
15
16function new_header_output() {
17    remove_action( 'get_header', 'header_output', 20);
18    load_template(plugin_dir_path( __FILE__ ) . 'templates/header.php');
19}
20add_action('get_header', 'new_header_output');
21
22
23function action_function_name_391( $name, $args ){
24    print_r("custom header");
25}
26add_action( 'get_header', 'action_function_name_391', 10, 2 );
27
similar questions
queries leading to this page
replace header template from plugin