Skip to content

Instantly share code, notes, and snippets.

@alessandrotesoro alessandrotesoro/functions.php Secret
Created May 15, 2019

Embed
What would you like to do?
Add custom menu bubble notification to WordPress admin
function pno_show_pending_listings_count_bubble() {
global $menu;
$pending_count = '5';
$listings_menu_item = wp_list_filter( $menu, [ 2 => 'edit.php?post_type=listings' ] );
if ( ! empty( $listings_menu_item ) && is_array( $listings_menu_item ) ) {
$menu[ key( $listings_menu_item ) ][0] .= " <span class='awaiting-mod update-plugins count-" . esc_attr( $pending_count ) . "'><span class='pending-count'>" . absint( number_format_i18n( $pending_count ) ) . '</span></span>';
}
}
add_action( 'admin_menu', 'pno_show_pending_listings_count_bubble' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.