I am not sure what you want to do is doable (seems impossible to me but everything seems impossible until someone does it). I thought of a very ugly workaround.
add_filter( 'template_include', function( $template ) {
$temp = get_temp_dir() . basename( $template );
file_put_contents( $temp, str_replace( 'get_header(', 'get_header2(', file_get_contents( $template ) ) );
return $temp;
});
function get_header2( $name = null ) {
do_action( 'get_header', $name );
$templates = array();
if ( isset($name) )
$templates[] = "header-{$name}.php";
$templates[] = 'header.php';
// Backward compat code will be removed in a future release
if ('' == locate_template($templates, true))
load_template( MY PLUGIN PATH/header.php');
}
This replaces get_header with get_header2 in all templates before loading.
Related Posts:
- Customizing subject in comment notification e-mails
- How to Loop Plugin Option Field Set?
- Saving Plugin settings to the database
- HELP: Integrating WP with raw PHP code once published button is hit
- Scope for PHP Variables Assigned in functions.php or a plugin
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- wordpress plugin is not activating from widget
- Edit Yoast SEO breadcrumbs output [closed]
- Conditional attributes and logic per product category
- WordPress get_avatar function not correct working
- Redirect to another page using contact form 7? [closed]
- Check if variable is set in filter
- execute function after one completed
- Plugin onclick button activate other plugin
- Different registration form for different roles
- More gentle way to hook WordPress custom url
- How to add custom function to pluggable.php
- Checkbox show / hide output result
- Allow a particular user to access a particular plugin?
- Cookie value changes back to previous value after changing
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- adding dynamic/multiple slug values in ‘option_none_value’
- working code, not working – Plugin Dev
- Is admin section completely customizable in terms of styling?
- register_activation_hook doesn’t fire at all
- My ajax request don´t work and return 0
- WordPress environment not loading properly
- Populate select option with JSON file
- Saving an array to get_options
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- How to add a handler for a button in plugin?
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- Doing action based on input from options menu
- How use Dynamic hyperlink on each wordpress post?
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- What are the differences between WPINC and ABSPATH?
- Where do I put the code snippets I found here or somewhere else on the web?
- Using require_once in a Plugin?
- Why does including a file in theme’s functions.php not work?
- Change destination author link
- Add Top-Level Menu that opens URL
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- Display a text message if the field is not found and not if found
- Add a plugin before main container
- Where should I save an API key of my user when installing my plugin?
- Custom form action to handle data inside a plugin
- WP Post Template – Templates in own folder
- Override Plugin Script Fucnction in WordPress
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- Creating a Callback URL for WordPress Woocommerce to update Order Status
- Ajax call returning 0
- How to replace WordPress Media Upload Window with user’s device window?
- What is @Action in WordPress?
- Setup wp_schedule_event within a custom plugin
- WordPress checkbox and Illegal string offset
- plugins_url() works everywhere but wp_reqister_script()
- Integrating boxtal PHP library into a custom WordPress Plugin
- How to get specific string/value from an array? php [closed]
- WordPress Stock Update Programatically
- How can I fetch data from another website to my wordpress website with mysql database
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- Switch from wp-cron to a server cron job
- Why is it important to check for isset and is_array before checking in_array in this example?
- How to call external functions from a PHP script in a WordPress plugin?
- same user role or copy the user role to be same as the other role
- How can i listing current category and Featured Category post list?
- How to displaying Custom image, text and default image logo from Redux Framework option panel
- save_post_product action not firing
- How to get the custom field value using SQL query
- Prevent WordPress from sending set-cookie http header
- How use wp_insert_post and add og:custom tags?
- How to change “Read More” text?
- Easiest way to load/fire a handful of functions, IF checkbox is checked?
- Using id to show item
- post id or permalink auto-incrementing number and reset everyday
- Generate and send ICS file through WordPress
- How to make the first letter of a post title uppercase, in a plugin?
- Change pricing in Woocommerce based on Category and Product [closed]
- Migrating custom php we wrote from functions.php into a site-specific plugin
- Creating a user ‘add custom field’ section
- Cannot access variables within a widget
- Is there any wordpress function to update a random post every 10 minutes?
- WordPress plugin options need to delete after deactivate & uninstall
- WordPress function to add text
- Showing author box on post detail page
- Help me with my first very basic plugin
- My wordpress website admin panel loads very slow, what can i do about that? [closed]
- is_plugin_active() not defined on active plugin, in the thumbnails.php file
- How to create post comparison in wordpress
- Requires PHP version 5.3.0
- wp_handle_upload – specified file failed upload test
- How to change all the urls of the WordPress site?
- How to make a Template page to show the information of different things Shop and Product page?
- How to trigger plugin migration code when plugin updates?
- How to Save Category and Delete Category in same Function
- public custom posts not showing in my wordpress plugin
- I want to allow certain file types on dokan upload files