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
1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 | 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.