Last active
December 26, 2015 08:19
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>'; | |
} | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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