Skip to main content
1 of 2
Sabbir Hasan
  • 1.4k
  • 1
  • 8
  • 14

I will get you some idea on how to do this as you didn't mention from where count data will come. Add following code to your theme/child-theme functions.php file

function custom_admin_bar_menu() {
    if ( current_user_can( 'manage_options' ) ) {
        global $wp_admin_bar;

        //Add an icon with count
        $wp_admin_bar->add_menu( array(
            'id'    => 'custom-1', //Change this to yours
            'title' => '<span class="ab-icon dashicons dashicons-cart"></span><span class="ab-label">0</span>',
            'href'  => get_admin_url( NULL, 'admin.php?page=#' ),//Replace with your resired destination
        ) );

        //Add another icon with count
        $wp_admin_bar->add_menu( array(
            'id'    => 'custom-2', //Change this to yours
            'title' => '<span class="ab-icon dashicons dashicons-chart-line"></span><span class="ab-label">0</span>',
            'href'  => get_admin_url( NULL, 'admin.php?page=#' ),//Replace with your resired destination
        ) );

        //Add another icon with count
        $wp_admin_bar->add_menu( array(
            'id'    => 'custom-3', //Change this to yours
            'title' => '<span class="ab-icon dashicons dashicons-carrot"></span><span class="ab-label">0</span>',
            'href'  => get_admin_url( NULL, 'admin.php?page=#' ),//Replace with your resired destination
        ) );

        //You can add more as per your need.
    }
}
add_action( 'admin_bar_menu', 'custom_admin_bar_menu' , 500 );

The 0 inside <span class="ab-label">0</span> represents the count. You can easily replace that by using a variable and some custom query.

Sabbir Hasan
  • 1.4k
  • 1
  • 8
  • 14