bp_nouveau_get_nav_count ()
检索当前导航项的count属性。
描述
返回
(int)导航项的count属性。
源
文件:bp-templates / bp-nouveau /包括/ template-tags.php
函数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) str_replace(',', ',', $nav_item->count); / /目录} elseif ('groups' === $bp_nouveau->displayed_nav && ('members' === $nav_item->slug || 'all-members' === $nav_item->slug)) {$count = group_get_current_group ()->total_member_count;} elseif ('groups' === $bp_nouveau->displayed_nav && 'subgroups' === $nav_item->slug) {$count = count(bp_get_descenden_groups (bp_get_current_group_id(), bp_loggedin_user_id()));} elseif ('groups' === $bp_nouveau->displayed_nav && 'leaders' == $nav_item->slug) {$group = group_get_current_group ();$admin = group_get_group_admins ($group->id);$mods = groups_get_group_mods($group->id);$count = sizeof($admins) + sizeof($mods); // @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, ' 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 BuddyPress 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 ); }
更新日志
版本 | 描述 |
---|---|
BuddyPress 3.0.0 | 介绍了。 |