Last active
May 5, 2017 04:13
-
-
Save enqtran/d5199f756e15d51d193e27688557b291 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* show bubble news | |
*/ | |
if ( !function_exists( 'add_news_menu_bubble' ) ) { | |
function add_news_menu_bubble() { | |
if ( current_user_can('administrator') ) { | |
global $menu; | |
$count = wp_count_posts( $post_type ='news' ); | |
$private_count = $count->pending; | |
if ( $count ) { | |
foreach ( $menu as $key => $value ) { | |
if ( $menu[$key][2] == 'edit.php?post_type=news' ) { | |
$menu[$key][0] .= " <span class='update-plugins count-".$private_count."'><span class='plugin-count'>" . $private_count . "</span></span>"; | |
return; | |
} | |
} | |
} | |
} | |
} | |
add_action( 'admin_menu', 'add_news_menu_bubble' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment