Last active
March 31, 2022 21:57
-
-
Save KaineLabs/aa0c1080d84952c08f92f24225984dd9 to your computer and use it in GitHub Desktop.
Add Notifications And Messages Nav Menu Counts.
is there a shortcode for this function?
For Shortcodes:
<?php
/*
* Notification Icon with Counter Shortcode
* use [noticon]
*/
function yzc_notification_sc(){
$notifications_count = bp_notifications_get_unread_notification_count();
$not_icon = '<i class="fa fa-bell"></i><span class="yz-notification-count-header" style="color: #fff; text-align: center; background-color: #4990ee; border-radius: 100%;">'. $notifications_count . '</span>';
return $not_icon;
}
add_shortcode('noticon','yzc_notification_sc');
/*
* Message Icon with Counter Shortcode
* use [mesicon]
*/
function yzc_message_sc(){
$msgs_count = bp_get_total_unread_messages_count();
$mes_icon = '<i class="fa fa-envelope"></i><span class="yz-message-count-header" style="color: #fff; text-align: center; background-color: #4990ee; border-radius: 100%;">'. $msgs_count . '</span>';
return $mes_icon;
}
add_shortcode('mesicon','yzc_message_sc');
?>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What if I need it as a shortcode? [yz_notifications_count] [yz_messages_count] something like that.