Astra_Ext_Advanced_Headers_Markup::load_markup()

Advanced Headers markup loader


Description

Loads appropriate template file based on the style option selected in options panel.


Source

File: addons/advanced-headers/classes/class-astra-ext-advanced-headers-markup.php

		public function load_markup() {

			// Get our options.
			$advanced_headers_layout         = Astra_Ext_Advanced_Headers_Loader::astra_advanced_headers_layout_option( 'layout' );
			$advanced_headers_merged         = Astra_Ext_Advanced_Headers_Loader::astra_advanced_headers_layout_option( 'merged' );
			$advanced_header_bg_size         = Astra_Ext_Advanced_Headers_Loader::astra_advanced_headers_design_option( 'bg-size' );
			$advanced_header_parallax_device = Astra_Ext_Advanced_Headers_Loader::astra_advanced_headers_design_option( 'parallax-device' );

			if ( ! self::advanced_header_enabled() || ( is_front_page() && 'posts' == get_option( 'show_on_front' ) ) ) {
				return;
			}

			if ( ! $advanced_headers_merged ) {
				$combined = 'ast-title-bar-wrap';

				// Parallax variable.
				$parallax = ( 'none' !== $advanced_header_parallax_device ) ? '  ast-advanced-headers-parallax' : '';
				// Parallax Device.
				$parallax_device = ( 'none' !== $advanced_header_parallax_device ) ? $advanced_header_parallax_device : '';
				// Parallax speed variable.
				$parallax_speed = apply_filters( 'astra_advanced_header_parallax_speed', 2 );
				// Full Screen vertical align center.
				$vertical_center = ' ast-advanced-headers-vertical-center';
				// Full Screen.
				$full_screen = ( 'full-screen' == $advanced_header_bg_size ) ? ' ast-full-advanced-header' : '';

				// Add advanced header wrapper classes.
				printf(
					'<div class="%1$s" %2$s role="img" %3$s>',
					$combined . $parallax . $full_screen . $vertical_center,
					( ! empty( $parallax ) ) ? 'data-parallax-speed="' . esc_attr( $parallax_speed ) . '" data-parallax-device="' . esc_attr( $parallax_device ) . '"' : '',
					$this->get_header_background_image_alt_text() // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
				);
			}

			if ( 'disable' !== $advanced_headers_layout ) {
				// Add markup.
				astra_get_template( 'advanced-headers/template/' . $advanced_headers_layout . '.php' );
			}

			echo '</div>';

			// Page Header with no content is selected.
			if ( 'disable' != $advanced_headers_layout ) {
				add_filter( 'astra_the_title_enabled', '__return_false' );
			}

		}

Changelog

Changelog
Version Description
1.0.0 Introduced.


User Contributed Notes

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