-
-
Save alessandrotesoro/43fd9b220e2cfec00a9f2d541d80dd5e to your computer and use it in GitHub Desktop.
Add custom menu bubble notification to WordPress admin
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
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