astra_get_header_classes()

Return classnames for <header> element.


Description


Return

(Array) classnames for the <header>


Source

File: inc/markup-extras.php

function astra_get_header_classes() {
		$classes                       = array( 'site-header' );
		$menu_logo_location            = astra_get_option( 'header-layouts' );
		$mobile_header_alignment       = astra_get_option( 'header-main-menu-align' );
		$primary_menu_disable          = astra_get_option( 'disable-primary-nav' );
		$primary_menu_custom_item      = astra_get_option( 'header-main-rt-section' );
		$logo_title_inline             = astra_get_option( 'logo-title-inline' );
		$mobile_header_logo            = astra_get_option( 'mobile-header-logo' );
		$different_mobile_header_order = astra_get_option( 'different-mobile-logo' );
		/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
		$hide_custom_menu_mobile     = astra_get_option( 'hide-custom-menu-mobile', false );
		$menu_mobile_target          = astra_get_option( 'mobile-header-toggle-target', 'icon' );
		$submenu_container_animation = astra_get_option( 'header-main-submenu-container-animation' );
		$builder_menu_mobile_target  = astra_get_option( 'header-builder-menu-toggle-target', 'icon' );

	if ( '' !== $submenu_container_animation ) {
		$classes[] = 'ast-primary-submenu-animation-' . $submenu_container_animation;
	}

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

	if ( $primary_menu_disable ) {

		$classes[] = 'ast-primary-menu-disabled';

		if ( 'none' == $primary_menu_custom_item ) {
			$classes[] = 'ast-no-menu-items';
		}
	} else {
		$classes[] = 'ast-primary-menu-enabled';
	}

		// Add class if Mobile Header Logo is set.
	if ( '' !== $mobile_header_logo && '1' == $different_mobile_header_order ) {
		$classes[] = 'ast-has-mobile-header-logo';
	}

		// Add class if Inline Logo & Site Title.
	if ( $logo_title_inline ) {
		$classes[] = 'ast-logo-title-inline';
	}

	if ( '1' == $hide_custom_menu_mobile ) {
		$classes[] = 'ast-hide-custom-menu-mobile';
	}

	if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
		$classes[] = 'ast-builder-menu-toggle-' . $builder_menu_mobile_target;
	} else {
		$classes[] = 'ast-menu-toggle-' . $menu_mobile_target;
	}

	$classes[] = 'ast-mobile-header-' . $mobile_header_alignment;

	$classes = array_unique( apply_filters( 'astra_header_class', $classes ) );

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

	return apply_filters( 'astra_get_header_classes', $classes );
}

Changelog

Changelog
Version Description
2.1.0 Introduced.


User Contributed Notes

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