bp_nouveau_get_nav_count()
Retrieve the count attribute for the current nav item.
Return Return
(int) The count attribute for the nav item.
Source Source
File: bp-templates/bp-nouveau/includes/template-tags.php
function bp_nouveau_get_nav_count() { $bp_nouveau = bp_nouveau(); $nav_item = $bp_nouveau->current_nav_item; $count = 0; if ( 'directory' === $bp_nouveau->displayed_nav ) { $count = (int) $nav_item->count; } elseif ( 'groups' === $bp_nouveau->displayed_nav && 'members' === $nav_item->slug ) { $count = groups_get_current_group()->total_member_count; // @todo imho BuddyPress shouldn't add html tags inside Nav attributes... } elseif ( 'personal' === $bp_nouveau->displayed_nav && ! empty( $nav_item->primary ) ) { $span = strpos( $nav_item->name, '<span' ); // Grab count out of the <span> element. if ( false !== $span ) { $count_start = strpos( $nav_item->name, '>', $span ) + 1; $count_end = strpos( $nav_item->name, '<', $count_start ); $count = (int) substr( $nav_item->name, $count_start, $count_end - $count_start ); } } /** * Filter to edit the count attribute for the nav item. * * @since 3.0.0 * * @param int $count The count attribute for the nav item. * @param object $nav_item The current nav item object. * @param string $value The current nav in use (eg: 'directory', 'groups', 'personal', etc..). */ return (int) apply_filters( 'bp_nouveau_get_nav_count', $count, $nav_item, $bp_nouveau->displayed_nav ); }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |