Replace get_header() or header.php via plugin
-
How can I replace get_header function or header.php via plugin?
I installed a child theme and now I’d like to add an html code into header.php
I used this:
function myheader( $template ) { if ( locate_template( 'header.php' ) != '' ) { return untrailingslashit( plugin_dir_path( __FILE__ ) ) . 'header.php'; } return $template; } add_filter( 'template_include', 'myheader', 11 );
It replaces the header and shows only the header and not the full template (the content, sidebar, footer…)
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Replace get_header() or header.php via plugin’ is closed to new replies.