Astra_Ext_Header_Sections_Markup::body_classes( array $classes )
Add Body Classes
Description
Parameters
- $classes
-
(array) (Required) Body Class Array.
Return
(array)
Source
File: addons/header-sections/classes/class-astra-ext-header-sections-markup.php
public function body_classes( $classes ) {
// Apply Above Below header layout class to the body.
$above_header_on_mobile = astra_get_option( 'above-header-on-mobile' );
$below_header_on_mobile = astra_get_option( 'below-header-on-mobile' );
$below_header_enabled = $this->astra_below_header_enabled();
$below_header_hover_bg = astra_get_option( 'below-header-menu-bg-hover-color-responsive' );
$below_header_active_bg = astra_get_option( 'below-header-current-menu-bg-color-responsive' );
$below_header_menu_bg_color = astra_get_option( 'below-header-menu-bg-obj-responsive' );
$below_header_menu_bg_color = array( $below_header_menu_bg_color['desktop']['background-color'], $below_header_menu_bg_color['tablet']['background-color'], $below_header_menu_bg_color['mobile']['background-color'] );
$below_hover_bg_count = count( array_filter( $below_header_hover_bg ) );
$below_active_bg_count = count( array_filter( $below_header_active_bg ) );
$below_header_bg_count = count( array_filter( $below_header_menu_bg_color ) );
if ( $below_header_enabled && 0 == $below_hover_bg_count && 0 == $below_active_bg_count && 0 == $below_header_bg_count ) {
$classes[] = 'below-header-nav-padding-support';
}
// Apply Above Header header layout class to the body.
$above_header_enabled = $this->astra_above_header_enabled();
$above_header_hover_bg = astra_get_option( 'above-header-menu-h-bg-color-responsive' );
$above_header_active_bg = astra_get_option( 'above-header-menu-active-bg-color-responsive' );
$above_header_menu_bg_color = astra_get_option( 'above-header-menu-bg-obj-responsive' );
$above_header_menu_bg_color = array( $above_header_menu_bg_color['desktop']['background-color'], $above_header_menu_bg_color['tablet']['background-color'], $above_header_menu_bg_color['mobile']['background-color'] );
$above_hover_bg_count = count( array_filter( $above_header_hover_bg ) );
$above_active_bg_count = count( array_filter( $above_header_active_bg ) );
$above_header_menu_bg_color_cnt = count( array_filter( $above_header_menu_bg_color ) );
if ( $above_header_enabled && 0 == $above_hover_bg_count && 0 == $above_active_bg_count && 0 == $above_header_menu_bg_color_cnt ) {
$classes[] = 'above-header-nav-padding-support';
}
if ( ! $above_header_on_mobile ) {
$classes[] = 'ast-above-header-hide-on-mobile';
}
if ( ! $below_header_on_mobile ) {
$classes[] = 'ast-below-header-hide-on-mobile';
}
return $classes;
}
Expand full source code Collapse full source code View on Trac