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

Proper way to hook wp_get_attachment_url

Hook wp_get_attachment_link for this purpose. Here is an example of how to do it – function attachment_link_filter( $content, $post_id, $size, $permalink ) {       // Only do this if we’re getting the file URL     if (! $permalink) {         // This returns an array of (url, width, height)         $image = wp_get_attachment_image_src( $post_id, ‘large’ );         $new_content = … Read more

Am I not understanding plugins?

when faced something similar I found a solution that works if your framework resides inside a plugin (so it seems). If your main plugin file (one that is recognized by WordPress as the plugin file) is in, e.g. /plugin/Aisis/ you can put this path in a constant, eg. define(‘AISISPATH’, dirname(__FILE__)); require ( trailingslashit (AISISPATH) . … Read more

Customize multisite site creation with user data

To create a basic plugin, add a directory in wp-content/plugin, then put a php file in it with the required header, and that’s it. Now, here is how to use the action : add_action( ‘wpmu_new_blog’, ‘user16975_customize_blog’, 10, 6); function user16975_customize_blog($blog_id, $user_id, $domain, $path, $site_id, $meta ){ // do not forget to select the correct blog … Read more

Generating User(s) with Settings API

You are using add_settings_field wrong: the function sl_wp_create_user is being passed as $args (and you probably don’t need any args), and it should be the sanitize callback for register_settings. Make the input like: function sl_render_users_input() { echo ‘<input id=”num_users[value]” name=”num_users[value]” type=”input” value=”” />’; } And the sanitize function: function sl_wp_create_user( $input ) { if( isset( … Read more