bp_nouveau_get_nav_classes ()

为当前导航项检索用空格分隔的类列表。

描述

返回

(字符串)类的列表。

文件:bp-templates / bp-nouveau /包括/ template-tags.php

函数bp_nouveau_get_nav_classes() {$bp_nouveau = bp_nouveau();nav_item = bp_nouveau美元- > current_nav_item;$ =类数组();If ('directory' === $bp_nouveau->displayed_nav) {If (!$class = (array) $nav_item->li_class;} if (bp_get_current_member_type() || (bp_is_groups_directory() && bp_get_current_group_directory_type()) {$classes[] = 'no-ajax';}} elseif ('groups' === $bp_nouveau->displayed_nav || 'personal' === $bp_nouveau->displayed_nav) {$classes = array('bp-' . 'bp ');bp_nouveau - > displayed_nav。“选项卡”);选择美元= bp_current_action (); // User's primary nav if ( ! empty( $nav_item->primary ) ) { $selected = bp_current_component(); // Group Member Tabs } elseif ( 'group_members' === $bp_nouveau->object_nav ) { $selected = bp_action_variable( 0 ); $classes = array( 'bp-' . $bp_nouveau->displayed_nav . '-member-tab' ); // Group Admin Tabs. } elseif ( 'group_manage' === $bp_nouveau->object_nav ) { $selected = bp_action_variable( 0 ); $classes = array( 'bp-' . $bp_nouveau->displayed_nav . '-admin-tab' ); // If we are here, it's the member's subnav } elseif ( 'personal' === $bp_nouveau->displayed_nav ) { $classes = array( 'bp-' . $bp_nouveau->displayed_nav . '-sub-tab' ); } if ( $nav_item->slug === $selected || ( $nav_item->slug == 'just-me' && strpos( $selected, 'just-me' ) !== false ) ) { $classes = array_merge( $classes, array( 'current', 'selected' ) ); } } if ( ! empty( $classes ) ) { $classes = array_map( 'sanitize_html_class', $classes ); } /** * Filter to edit/add classes. * * NB: you can also directly add classes into the template parts. * * @since BuddyPress 3.0.0 * * @param string $value A space separated list of classes. * @param array $classes The list of classes. * @param object $nav_item The current nav item object. * @param string $value The current nav in use (eg: 'directory', 'groups', 'personal', etc..). */ $classes_list = apply_filters( 'bp_nouveau_get_classes', join( ' ', $classes ), $classes, $nav_item, $bp_nouveau->displayed_nav ); if ( ! $classes_list ) { $classes_list = ''; } return $classes_list; }

更新日志

更新日志
版本 描述
BuddyPress 3.0.0 介绍了。

问题吗?

我们总是很乐意帮助您解决代码或其他问题!搜索我们的开发人员文档联络支持,或与我们联系销售团队