bp_nouveau_get_loop_classes()

获取组件的循环类

描述

返回

(字符串)用空格分隔类的值。

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

函数bp_nouveau_get_loop_classes() {$bp_nouveau = bp_nouveau();//如果是单组成员循环,则$组件是假的if (!Bp_is_directory () && (bp_is_group() && 'members' === bp_current_action())) {$component = 'members_group';} elseif (!Bp_is_directory () && (bp_is_user() && ('my-friends' === bp_current_action() || 'mutual' === bp_current_action()))) {$component = 'members_friends';} else {$component = sanitize_key(bp_current_component());} $ =类数组(“项目列表”,sprintf(%列出,。大小写不敏感 ( '_', '-', $ 组件)、“bp-list”);If (bp_is_user() && 'my-friends' === bp_current_action()) {$classes[] = ' memberlist ';} if (bp_is_user() && 'requests' === bp_current_action()) {$classes[] = 'friends-request-list';} if (bp_is_user() && 'mutual' === bp_current_action()) {$classes[] = 'friends-mutual-list'; } $available_components = array( 'members' => true, 'groups' => true, 'blogs' => true, /* * Technically not a component but allows us to check the single group members loop as a seperate loop. */ 'members_group' => true, 'members_friends' => true, ); // Only the available components supports custom layouts. if ( ! empty( $available_components[ $component ] ) && ( bp_is_directory() || bp_is_group() || bp_is_user() ) ) { $customizer_option = sprintf( '%s_layout', $component ); $layout_prefs = bp_nouveau_get_temporary_setting( $customizer_option, bp_nouveau_get_appearance_settings( $customizer_option ) ); // check for layout options in browsers storage $list = false; if ( isset( $_POST['extras'] ) && ! empty( $_POST['extras']['layout'] ) && 'list' == $_POST['extras']['layout'] ) { $list = true; } if ( $layout_prefs && (int) $layout_prefs > 1 ) { $grid_classes = bp_nouveau_customizer_grid_choices( 'classes' ); if ( isset( $grid_classes[ $layout_prefs ] ) && ! $list ) { $classes = array_merge( $classes, array( 'grid', 'four',/*Remove customizer number of columns in grid view*/ //$grid_classes[ $layout_prefs ],/*Remove customizer number of columns in grid view*/ ) ); } else { $classes = array_merge( $classes, array( 'four',/*Remove customizer number of columns in grid view*/ //$grid_classes[ $layout_prefs ],/*Remove customizer number of columns in grid view*/ ) ); } if ( ! isset( $bp_nouveau->{$component} ) ) { $bp_nouveau->{$component} = new stdClass; } // Set the global for a later use. $bp_nouveau->{$component}->loop_layout = $layout_prefs; } } /** * Filter to edit/add classes. * * NB: you can also directly add classes into the template parts. * * @since BuddyPress 3.0.0 * * @param array $classes The list of classes. * @param string $component The current component's loop. */ $class_list = (array) apply_filters( 'bp_nouveau_get_loop_classes', $classes, $component ); return join( ' ', array_map( 'sanitize_html_class', $class_list ) ); }

更新日志

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

问题吗?

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