Skip to content

Instantly share code, notes, and snippets.

@itsmereal
Last active December 26, 2015 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsmereal/7121132 to your computer and use it in GitHub Desktop.
Save itsmereal/7121132 to your computer and use it in GitHub Desktop.
BuddyPress Notifications Code prepared for drop down menu. Added CSS for simple navigation output
<?php
function bp_notification_badge() {
if ( is_user_logged_in() ) {
echo '<ul class="noti_nav">';
$notifications = bp_core_get_notifications_for_user( bp_loggedin_user_id() );
if ( $notifications ) {
$counter = 0;
for ( $i = 0; $i < count($notifications); $i++ ) {
$badge = count($notifications);
echo '<li><a>'.$badge.'</a>';
echo '<ul class="sub_noti_nav">';
echo '<li>'.$notifications[$i].'</li>';
echo '</ul>';
}
}
echo '</li>';
echo '</ul>';
}
}
?>
.noti_nav li {
position: relative;
}
.sub_noti_nav {
display: none;
position: absolute;
left: 0;
top: 100%;
}
.noti_nav li:hover .sub_noti_nav {
display: block;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment