Adding content to a taxonomy metabox

From core: function post_tags_meta_box($post, $box) { $defaults = array(‘taxonomy’ => ‘post_tag’); if ( !isset($box[‘args’]) || !is_array($box[‘args’]) ) $args = array(); else $args = $box[‘args’]; extract( wp_parse_args($args, $defaults), EXTR_SKIP ); $tax_name = esc_attr($taxonomy); $taxonomy = get_taxonomy($taxonomy); $disabled = !current_user_can($taxonomy->cap->assign_terms) ? ‘disabled=”disabled”‘ : ”; $comma = _x( ‘,’, ‘tag delimiter’ ); ?> <div class=”tagsdiv” id=”<?php echo $tax_name; … Read more

Removing the TinyMCE editor for a given page template

You can try to hook on load-page hook instead of admin_init. It is supposed to be called only when a page is being edited, and then you should be able to use the global $post variable function hide_editor() { global $post; $template_file = get_post_meta($post->ID, ‘_wp_page_template’, true); if($template_file == ‘page-home.php’){ // template name here remove_post_type_support(‘page’, ‘editor’); … Read more

Adding Custom Capabilites

I just happened to provide a short example of setting up a custom role capability (exaplanation and code). In your case, however, you want to add the capability to particular users – not roles. The following code may be a starting point for what you want to do: >>> Setting it up // The IDs … Read more

Add javascript confirmation popup on “Move to Trash” link

Put the following in your functions.php: if (! empty($GLOBALS[‘pagenow’]) && ‘post.php’ === $GLOBALS[‘pagenow’]) add_action(‘admin_footer’, ‘trash_click_error’); function trash_click_error() { echo <<<JQUERY <script> jQuery(function($) { $(‘#delete-action a’).unbind(); $(‘#delete-action a’).click(function(event) { event.preventDefault(); alert(‘Error!’); setTimeout( function() { $(‘#save-action .spinner’).hide(); $(‘#publish’).removeClass(‘button-primary-disabled’); }, 1 ); }); }); </script> JQUERY; }

How to create a custom template to admin dashboard

Codex has documentation on creating custom login pages – Customize Login Form > Make Custom Login Page, using wp_login_form() function. This should load everything necessary to log user in. However, unlike login, replacing admin would be much more involved and have many approaches. Typically to access admin function in non-admin context admin PHP files have … Read more