Reply To: [Resolved] How To Get Notification Count? (Code)?
Hi guys
we are looking for solution to get buddypress notifications work on our theme, we know it will be shown on wordpress’s default top tool bar but we want it to show somewhere else.
We are using WP 4.3 with buddypress 2.3.3, we have added these to theme’s functions.php
function bpfr_add_notification_to_page_title( $title, $original_title, $sep ) {
//do not change if the user is not logged in
if( ! is_user_logged_in() )
return $title;
$user_id = get_current_user_id();//logged in user's id
$count = bp_notifications_get_unread_notification_count( $user_id );
if( $count > 0 )
$title = sprintf( "You Have %d New Notification(s) - ", $count );
return $title;
}
add_filter( 'wp_title', 'bpfr_add_notification_to_page_title', 100, 3 );
then we add these to theme ‘s menu location
<?php echo bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ); ?>
but it is showing nothing, what is the correct steps to make this work please?
thanks