I found code to show a notification bar on menu and customize it a little. It is working and shown on main menu (primary menu) and footer menu (secondary menu) but I want to show it only main menu. How to do that? Here's what I have:
function my_counter_nav_menu( $menu ) {
$notif_url = bp_core_get_user_domain( bp_loggedin_user_id() ) . 'notifications/';
$friends_url = bp_core_get_user_domain( bp_loggedin_user_id() ) . 'friends/';
$msg_url = bp_core_get_user_domain( bp_loggedin_user_id() ) . 'messages/';
if ( ! is_user_logged_in() ) {
return $menu;
} else {
$notif = '<li><a href=" ' . $notif_url . ' "> <i class="fa fa-bell-o" aria-hidden="true"></i> Notifications [' . bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ) . ']</a></li>';
}
$menu = $menu . $notif;
return $menu;
}
add_filter( 'wp_nav_menu_items', 'my_counter_nav_menu' );