bp_nouveau_get_container_classes()

Returns the main BuddyPress container classes.

Description

Return

(string) CSS classes

Source

File: bp-templates/bp-nouveau/includes/template-tags.php

	function bp_nouveau_get_container_classes() {
		$classes           = array( 'buddypress-wrap' );
		$component         = bp_current_component();
		$bp_nouveau        = bp_nouveau();
		$member_type_class = '';

		if ( bp_is_user() ) {
			$customizer_option = 'user_nav_display';
			$component         = 'members';
			$user_type         = bp_get_member_type( bp_displayed_user_id() );
			$member_type_class = ( $user_type )? $user_type : '';

		} elseif ( bp_is_group() ) {
			$customizer_option = 'group_nav_display';

		} elseif ( bp_is_directory() ) {
			switch ( $component ) {
				case 'activity':
					$customizer_option = 'activity_dir_layout';
					break;

				case 'members':
					$customizer_option = 'members_dir_layout';
					break;

				case 'groups':
					$customizer_option = 'groups_dir_layout';
					break;

				case 'blogs':
					$customizer_option = 'sites_dir_layout';
					break;

				case 'media':
					$customizer_option = 'media_dir_layout';
					break;

				default:
					$customizer_option = '';
					break;
			}

		} else {
			/**
			 * Filters the BuddyPress Nouveau single item setting ID.
			 *
			 * @since BuddyPress 3.0.0
			 *
			 * @param string $value Setting ID.
			 */
			$customizer_option = apply_filters( 'bp_nouveau_single_item_display_settings_id', '' );
		}

		if ( $member_type_class ) {
			$classes[] = $member_type_class;
		}

		// Provide a class token to acknowledge additional extended profile fields added to default account reg screen
		if ( 'register' === bp_current_component() && bp_is_active( 'xprofile' ) && bp_nouveau_base_account_has_xprofile()) {
			$classes[] = 'extended-default-reg';
		}

		// Add classes according to site owners preferences. These are options set via Customizer.

		// Set via earlier switch for component check to provide correct option key.
		if ( $customizer_option ) {
			$layout_prefs  = bp_nouveau_get_temporary_setting( $customizer_option, bp_nouveau_get_appearance_settings( $customizer_option ) );

			if ( $layout_prefs && (int) $layout_prefs === 1 && ( bp_is_user() || bp_is_group() ) ) {
				$classes[] = 'bp-single-vert-nav';
				$classes[] = 'bp-vertical-navs';
			}

			if ( $layout_prefs && bp_is_directory() ) {
				$classes[] = 'bp-dir-vert-nav';
				$classes[] = 'bp-vertical-navs';
				$bp_nouveau->{$component}->directory_vertical_layout = $layout_prefs;
			} else {
				$classes[] = 'bp-dir-hori-nav';
			}
		}

		$class = array_map( 'sanitize_html_class', $classes );

		/**
		 * Filters the final results for BuddyPress Nouveau container classes.
		 *
		 * This filter will return a single string of concatenated classes to be used.
		 *
		 * @since BuddyPress 3.0.0
		 *
		 * @param string $value   Concatenated classes.
		 * @param array  $classes Array of classes that were concatenated.
		 */
		return apply_filters( 'bp_nouveau_get_container_classes', join( ' ', $class ), $classes );
	}

Changelog

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.