Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Bp custom Menu

@livingflame

Participant

RESOLVED! Thanks @sbrajesh

CODE :::::::: Put this Code Inside your function.php ChildTheme

//Add Count Near Nav Menu With Bubble
function my_counter_nav_menu($menu) {

	if ( ! is_user_logged_in() ) {
		return $menu;
	}

	$user_id = bp_loggedin_user_id();
	$user_url = bp_loggedin_user_domain();

	$msg_url = $user_url . bp_get_messages_slug() . '/';
	$notify_url = $user_url . bp_get_notifications_slug() . '/';

	ob_start();
	?>
	<li><a>">Messages <span class="my_bubble_notify"><?php echo bp_get_total_unread_messages_count( $user_id );?></span> </a></li>
	
	<li><a>">Notifications <span class="my_bubble_notify"> <?php echo bp_notifications_get_unread_notification_count( $user_id );?></span> </a></li>
<?php
	$menu_items = ob_get_clean();

	$menu = $menu . $menu_items;
	return $menu;
}
add_filter( 'wp_nav_menu_items', 'my_counter_nav_menu' );

––––––––––––
CSS::::: Put this Code Inside your style.css ChildTheme

.my_bubble_notify {
border-radius: 25%;
border: 1px solid #ccc;
background: #eee;
color: #6c6c6c;
display: inline;
margin-left: 1px;
padding: 2px 6px;
text-align: center;
vertical-align: center;
font-size: small;
}

Skip to toolbar