Utilizing WordPress’ Admin UI for plugin settings: getting accordion style

Here’s how I do it for my plugin/options page (which is inside a class, thus the $this-> construct): /* enqueue our css */ public function enqueue_options_style( $hook ) { if( $hook == $this->admin_page ) wp_enqueue_style( ‘my-options’, ‘/some-directory/my-options.css’, false, $this->version ); // only present for our plugin’s settings page } $this->admin_page is the slug returned from … Read more

Is there a way to remove the default css from TinyMCE?

You should be able to remove these by hooking into the mce_css filter in your functions.php file: add_filter(“mce_css”, “my_remove_mce_css”); function my_remove_mce_css($stylesheets){ return “”; } I haven’t tested this but it should work. You might want to echo out the value of $stylesheets before you return nothing just to see what else is coming through – … Read more

How do I add a custom button to my “edit” list? ( edit.php?post_type= ) beside “Add New”

I found a way to get it done but I am not very happy with this procedure. Please add your answer if you find better way. Mean while, this might be of help. add_action(‘admin_head-edit.php’,’addCustomImportButton’)); I only need this on edit page, so I am using admin_head-edit.php action, but you can use admin_head or some other … Read more

Prevent Selected Terms Rising to the Top

This bugs me too. It is very confusing, so I thought I’d look into it. That meta box is created in “wp-admin/includes/meta-boxes.php” on line ~399. It uses wp_terms_checklist. The problem codes seems to be this (it is one in source): <?php wp_terms_checklist( $post->ID, array( ‘taxonomy’ => $taxonomy, ‘popular_cats’ => $popular_ids ) ) ?> That leaves … Read more

Add on the fly tabs to plugin options

WordPress Tabs are non-standard, static html markup. You can only add the markup within your functions.php theme file or inside your plugin. <h2 class=”nav-tab-wrapper”> <a href=”#” class=”nav-tab”>Tab #1</a> <a href=”#” class=”nav-tab nav-tab-active”>Tab #2</a> <a href=”#” class=”nav-tab”>Tab #2</a> </h2> In this helper plugin (WordPress Admin Style) you’ll find the class references for the default markup of … Read more

How to save dismissable notice state in WP 4.2?

There’s no need for a library, it’s fairly straightforward to accomplish. If you are coding your own plugin (which it appears you are), then you can do this in a fairly lightweight way: A slightly modified version of the notice, which checks if it’s been dismissed before displaying, and stores the “type” of notice in … Read more