I would like to use create a function in my custom plugin to tell WP to use a different header

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; … Read more

What is the purpose of $merged_filters?

For those of you who may be wondering what this does – I have figured it out. When a new function is added to an action/filter hook, it is added at the end of the array. However, WordPress specifies that those functions are to be executed by priority. When a function is added, merged_filters is … Read more

I need some direction on how to have a sidebar based on meta rather than page

Create a sidebar $type . ‘_sidebar’ Register the sidebar $type . ‘_sidebar’ (e.g dog_sidebar) Pass the type as GET argument to the widget.php (create some menu entries or something else where you link to e.g. wp-admin/widgets.php?sidebar_type=dog_sidebar) Filter out every sidebar that should not be displayed. You can use this function: global $wp_registered_sidebars; $type =filter_input( INPUT_GET, … Read more

Using has_filter with a class based plugin to check whether the plugin is active or not

To do literally what you’re wanting here, the easiest way is to store the instance of the plugin class in a global variable at the end of your plugin: class My_Plugin { static $instance; function __construct(){} /* or private, with singleton get_instance() method */ function setup(){ … } } $my_plugin_instance = new My_Plugin(); add_action( ‘plugins_loaded’, … Read more

PGP-Encrypt system-generated notifications

There’s a small PGP plugin by Tim Nash on GitHub (but it’s not in the official WordPress repository, it needs to be manually copied to wordpress plugin directory). It’s a wrapper using php-pgp library for encryption. The article where I found this link is “Encrypting emails with PGP and WordPress”. This is the only WordPress … Read more