bp_nouveau_nav_has_count()
Checks if the nav item has a count attribute.
Description
Return
(bool)
Source
File: bp-templates/bp-nouveau/includes/template-tags.php
function bp_nouveau_nav_has_count() {
$bp_nouveau = bp_nouveau();
$nav_item = $bp_nouveau->current_nav_item;
$count = false;
if ( 'directory' === $bp_nouveau->displayed_nav ) {
$count = $nav_item->count;
} elseif ( 'groups' === $bp_nouveau->displayed_nav && 'members' === $nav_item->slug ) {
$count = 0 !== (int) groups_get_current_group()->total_member_count;
} elseif ( 'groups' === $bp_nouveau->displayed_nav && 'subgroups' === $nav_item->slug ) {
$count = 0 !== (int) count( bp_get_descendent_groups( bp_get_current_group_id(), bp_loggedin_user_id() ) );
} elseif ( 'personal' === $bp_nouveau->displayed_nav && ! empty( $nav_item->primary ) ) {
$count = (bool) strpos( $nav_item->name, '="count"' );
}
/**
* Filter to edit whether the nav has a count attribute.
*
* @since BuddyPress 3.0.0
*
* @param bool $value True if the nav has a count attribute. False otherwise
* @param object $nav_item The current nav item object.
* @param string $value The current nav in use (eg: 'directory', 'groups', 'personal', etc..).
*/
return (bool) apply_filters( 'bp_nouveau_nav_has_count', false !== $count, $nav_item, $bp_nouveau->displayed_nav );
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 3.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.