bp_nouveau_get_container_classes()

Returns the main BuddyPress container classes.


Return Return

(string) CSS classes


Source Source

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

	function bp_nouveau_get_container_classes() {
		$classes           = array( 'buddypress-wrap', get_template() );
		$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;

				default:
					$customizer_option = '';
					break;
			}

		} else {
			/**
			 * Filters the BuddyPress Nouveau single item setting ID.
			 *
			 * @since 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_has_signup_xprofile_fields()) {
			$classes[] = 'extended-default-reg';
		}

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

		// These are general site wide Cust options falling outside component checks
		$general_settings = bp_nouveau_get_temporary_setting( 'avatar_style', bp_nouveau_get_appearance_settings( 'avatar_style' ) );
		if ( $general_settings ) {
			$classes[] = 'round-avatars';
		}

		// 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';
			}
		}

		$global_alignment = bp_nouveau_get_temporary_setting( 'global_alignment', bp_nouveau_get_appearance_settings( 'global_alignment' ) );
		if ( $global_alignment && 'alignnone' !== $global_alignment && current_theme_supports( 'align-wide' ) ) {
			$classes[] = $global_alignment;
		}

		$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 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 );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
7.0.0 Add a class to inform about the active Theme.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.