/*Notification for Draft Graves*/
add_action( ‘admin_menu’, function() {
global $menu;
$count_posts = wp_count_posts(‘grave’);
$count = $count_posts->draft;

//$count = 5;
if ($count >= 1) {

$menu_item = wp_list_filter(
$menu,
array( 2 => ‘edit.php?post_type=grave’ ) // 2 is the position of an array item which contains URL, it will always be 2!
);
if ( ! empty( $menu_item ) ) {
$menu_item_position = key( $menu_item ); // get the array key (position) of the element
$menu[ $menu_item_position ][0] .= ‘ ‘ . $count . ‘‘;
}

}

});

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x