Astra_Ext_Header_Sections_Markup::add_scripts()

Add Scripts


Description


Source

File: addons/header-sections/classes/class-astra-ext-header-sections-markup.php

		public function add_scripts() {

			$below_header_layout      = astra_get_option( 'below-header-layout' );
			$below_header_meta        = astra_get_option_meta( 'ast-below-header-display' );
			$above_header_layout      = astra_get_option( 'above-header-layout' );
			$above_header_layout_meta = astra_get_option_meta( 'ast-above-header-display' );

			/*** Start Path Logic */

			/* Define Variables */
			$uri  = ASTRA_EXT_HEADER_SECTIONS_URL . 'assets/js/';
			$path = ASTRA_EXT_HEADER_SECTIONS_DIR . 'assets/js/';

			/* Directory and Extension */
			$file_prefix = '.min';
			$dir_name    = 'minified';

			if ( SCRIPT_DEBUG ) {
				$file_prefix = '';
				$dir_name    = 'unminified';
			}

			$js_uri = $uri . $dir_name . '/';
			$js_dir = $path . $dir_name . '/';

			if ( defined( 'ASTRA_THEME_HTTP2' ) && ASTRA_THEME_HTTP2 ) {
				$gen_path = $js_uri;
			} else {
				$gen_path = $js_dir;
			}

			/*** End Path Logic */

			if ( 'disabled' != $below_header_layout && 'disabled' != $below_header_meta ) {
				Astra_Minify::add_dependent_js( 'astra-theme-js' );
				Astra_Minify::add_js( $gen_path . 'ast-below-header' . $file_prefix . '.js' );
			}

			if ( 'disabled' != $above_header_layout && 'disabled' != $above_header_layout_meta ) {
				Astra_Minify::add_js( $gen_path . 'ast-above-header' . $file_prefix . '.js' );
			}
		}

User Contributed Notes

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