Skip to:
Content
Pages
Categories
Search
Top
Bottom

How can i assign a CSS class/selector to the unread notification count.


  • kaneesha
    Participant

    @kaneesha

    I try to get a different color for “new” notifications could somebody help please?

    My actual code in my theme functions.php:

    //notification alerts for posts
    function my_nav_menu_notif_counter($menu) {      
            if (!is_user_logged_in())
                    return $menu;
            else
                    $notif = '<a class="notices" href="' . bp_get_notifications_unread_permalink() . '"><span class="noticecount"><i class="noticecounttitle">Notifications</i>'. bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ) .'</span></a>';
                    $menu = $menu . $notif;
                    return $menu;
    }
    add_filter( 'wp_nav_menu_items', 'my_nav_menu_notif_counter' );
    
    //notification alerts for messages
    function my_nav_menu_msg_counter($menu) {      
            if (!is_user_logged_in())
                    return $menu;
            else
                    $notif = '<a class="notices" href="' . bp_loggedin_user_domain() . 'messages/' . '"><span class="noticecount2"><i class="noticecount2title">Messages</i>'. bp_get_total_unread_messages_count( bp_loggedin_user_id() ) .'</span></a>';
                    $menu = $menu . $notif;
                    return $menu;
    }
    
    

    Thank you in advance 🙂

Viewing 1 replies (of 1 total)

  • Prashant Singh
    Participant

    @prashantvatsh

    Hi,

    If you need a different color then you have to use the element class and add a CSS rule for it.

    For example:

    
    .your_class_name_here{
      background: your_color_code_here;
    }
    

    Thanks

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar