Skip to content

Instantly share code, notes, and snippets.

@zedejose
Last active December 29, 2015 04:28
Show Gist options
  • Save zedejose/7614648 to your computer and use it in GitHub Desktop.
Save zedejose/7614648 to your computer and use it in GitHub Desktop.
Code to add a count bubble of draft posts to the Posts menu.
// Add a count of draft posts to the Posts menu
function zedejose_add_draft_count() {
global $menu;
$count_posts = wp_count_posts();
$draft_posts = $count_posts->draft;
$menu[5][0] = $menu[5][0] . '<span class="update-plugins count-2"><span class="plugin-count">' . (int)$draft_posts . '</span></span>';
}
add_action( 'admin_menu', 'zedejose_add_draft_count' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment