Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Bp custom Menu

@livingflame

Participant

Hi @danbp
Me again.

First look at this:

// Add Count Near Nav Menu
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();

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

	ob_start();
	?>
	
	<li><a href="<?php echo $notify_url ?>">Notificaciones <span class="my_bubble"> <?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' );

This is a modification of your code for show notifications bubbles in Main Menu.

Okey, it works but, I dont want this line: <?php echo $notify_url ?>”>Notificaciones

I want to get bubbles for Buddypress-Nav-Menu. You know, Dashboard / Menus / Buddypress. Here you have buddypress links: profile, messages, etc. but, if you add “messages”, appear without counter. So, I want counter for these…

Skip to toolbar