astra_above_header_builder_sections_dynamic_css( string $dynamic_css, string $dynamic_css_filtered = '' )

Dynamic CSS


Description


Parameters

$dynamic_css

(string) (Required) Astra Dynamic CSS.

$dynamic_css_filtered

(string) (Optional) Astra Dynamic CSS Filters.

Default value: ''


Return

(string)


Source

File: addons/sticky-header/classes/dynamic-css/header-sections-dynamic.css.php

function astra_above_header_builder_sections_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) {

	/**
	 * Set colors
	 *
	 * If colors extension is_active then get color from it.
	 * Else set theme default colors.
	 */
	$stick_header            = astra_get_option_meta( 'stick-header-meta' );
	$stick_header_above_meta = astra_get_option_meta( 'header-above-stick-meta' );

	$stick_header_above = astra_get_option( 'header-above-stick' );

	$sticky_header_style   = astra_get_option( 'sticky-header-style' );
	$sticky_hide_on_scroll = astra_get_option( 'sticky-hide-on-scroll' );

	/**
	 * Above Header.
	 */
	$desktop_sticky_above_header_bg_color = astra_get_prop( astra_get_option( 'sticky-above-header-bg-color-responsive' ), 'desktop', '' );
	$tablet_sticky_above_header_bg_color  = astra_get_prop( astra_get_option( 'sticky-above-header-bg-color-responsive' ), 'tablet' );
	$mobile_sticky_above_header_bg_color  = astra_get_prop( astra_get_option( 'sticky-above-header-bg-color-responsive' ), 'mobile' );

	if ( ! $stick_header_above && ( 'disabled' !== $stick_header && empty( $stick_header ) && ( empty( $stick_header_above_meta ) ) ) ) {
		return $dynamic_css;
	}

	$above_header_sticky_selector = '.ast-above-sticky-header-active .ast-above-header.ast-header-sticked';
	$parse_css                    = '';

	/**
	 * Sticky Header
	 *
	 * [1]. Sticky Header Above colors options.
	 */

		/**
		 * Above Header.
		 */
	if ( 'none' === $sticky_header_style && ! $sticky_hide_on_scroll ) {

		$desktop_above_header_css_output = array(
			'.ast-above-header-bar.ast-header-sticked' => array(
				'z-index' => 9,
			),
			$above_header_sticky_selector              => array(
				'background' => esc_attr( $desktop_sticky_above_header_bg_color ),
			),
		);
		$tablet_above_header_css_output  = array(
			$above_header_sticky_selector => array(
				'background' => esc_attr( $tablet_sticky_above_header_bg_color ),
			),
		);
		$mobile_above_header_css_output  = array(
			$above_header_sticky_selector => array(
				'background' => esc_attr( $mobile_sticky_above_header_bg_color ),
			),
		);
	} else {
		// Only when Fixed Header Merkup added.
		$desktop_above_header_css_output = array(
			'#ast-fixed-header .ast-above-header' => array(
				'background' => esc_attr( $desktop_sticky_above_header_bg_color ),
			),
		);
		$tablet_above_header_css_output  = array(
			'#ast-fixed-header .ast-above-header' => array(
				'background' => esc_attr( $tablet_sticky_above_header_bg_color ),
			),
		);
		$mobile_above_header_css_output  = array(
			'#ast-fixed-header .ast-above-header' => array(
				'background' => esc_attr( $mobile_sticky_above_header_bg_color ),
			),
		);
	}

	/* Parse CSS from array() */
	$parse_css .= astra_parse_css( $desktop_above_header_css_output );
	$parse_css .= astra_parse_css( $tablet_above_header_css_output, '', astra_addon_get_tablet_breakpoint() );
	$parse_css .= astra_parse_css( $mobile_above_header_css_output, '', astra_addon_get_mobile_breakpoint() );

	return $dynamic_css . $parse_css;

}


User Contributed Notes

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