Adding a tooltip above Categories postbox in Post Editor

Place this code in your functions.php theme (or child theme) file. It uses jQuery to add a new box above the Category div (<div id=”categorydiv” class=”postbox ” >). add_action( ‘admin_footer-post.php’, ‘wpse_99252_add_categories_title_attribute’ ); add_action( ‘admin_footer-post-new.php’, ‘wpse_99252_add_categories_title_attribute’ ); /** * Add a title attribute to categories box in the Post Editor. */ function wpse_99252_add_categories_title_attribute() { ?> <script … Read more

Show box only on edit post

Check the post status using get_post_status( $ID ) and then display the html code according to the status. ( i.e ) You could simply use if else condition in your php template file to display different content based on the post status. I think new posts have auto-draft status. get_post_status codex should be helpful.

Custom Post Type Capabilities

Ok – lets try this again 🙂 I added the map_meta_cap parameter which is needed to have delete_others_posts work. Now I was able to get authors to edit and view all posts but only delete their own. $labels = array( ‘name’ => __( ‘Book’, ‘textdomain’ ), ‘singular_name’ => __( ‘Book’, ‘textdomain’ ), ‘menu_name’ => __( … Read more

Prevent stripping MathML tags on post save

The MathML tags are removed by the editor. TinyMCE (the editor) removes tags that are not in its “valid_elements” list. The MathML tags and tag-attributes must be added via the “extended_valid_elements” list (seen below). Place the below code in your functions.php file. function mce4_options($opt){ $opt[‘extended_valid_elements’] = ‘math[class|id|xmlns|altimg|alttext|display|overflow],semantics[encoding|definitionURL],annotation[encoding|definitionURL|cd|name|src],annotation-xml[cd|name|encoding|definitionURL|src],merror,mtext,mspace,mover[accent|align],munder,munderover,mstack,mrow[dir],msrow,mfenced[open|close|separators],menclose[notation],mphantom,msup,msub,msubsup,mmultiscripts,mi,mn,mo[fence],ms,mtable,mtr,mtd,mlabeledtr,mfrac[linethickness|bevelled|numalign|denomalign],mfraction,msline,msqrt,mroot,mscarries,mscarry’; return $opt; } add_filter(‘tiny_mce_before_init’,’mce4_options’,25); The above code is … Read more

Why would media_sideload_image() not work locally?

Ah, this is silly, but it turns out there was a very obvious reason why media_sideload_image() wasn’t working. My wp-content folder had the wrong the permissions from when I transferred it to my local environment and I wasn’t able to upload anything. Changed the permissions and it’s working fine.