Astra_Ext_Mobile_Header_Markup::add_scripts()

Add Scripts Callback


Description


Source

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

		public function add_scripts() {
			/*** Start Path Logic */
			$below_section_1     = astra_get_option( 'below-header-section-1' );
			$below_section_2     = astra_get_option( 'below-header-section-2' );
			$below_header_merged = astra_get_option( 'below-header-merge-menu' );
			$above_section_1     = astra_get_option( 'above-header-section-1' );
			$above_section_2     = astra_get_option( 'above-header-section-2' );
			$above_header_merged = astra_get_option( 'above-header-merge-menu' );

			$disable_primary_nav = astra_get_option( 'disable-primary-nav' );
			$mobile_menu_style   = astra_get_option( 'mobile-menu-style' );
			$above_header_style  = astra_get_option( 'mobile-above-header-menu-style' );
			$below_header_style  = astra_get_option( 'mobile-below-header-menu-style' );

			/* Define Variables */
			$uri  = ASTRA_EXT_MOBILE_HEADER_URL . 'assets/js/';
			$path = ASTRA_EXT_MOBILE_HEADER_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 */
			Astra_Minify::add_dependent_js( 'jquery' );

			if ( ! $above_header_merged && 'no-toggle' == $above_header_style && ( 'menu' === $above_section_1 || 'menu' === $above_section_2 ) ) {
				Astra_Minify::add_js( $gen_path . 'above-menu-no-toggle' . $file_prefix . '.js' );
			}

			if ( ! $below_header_merged && 'no-toggle' == $below_header_style && ( 'menu' === $above_section_1 || 'menu' === $above_section_2 ) ) {
				Astra_Minify::add_js( $gen_path . 'below-menu-no-toggle' . $file_prefix . '.js' );
			}

			if ( 'no-toggle' == $mobile_menu_style && '1' != $disable_primary_nav ) {
				Astra_Minify::add_js( $gen_path . 'primary-menu-no-toggle' . $file_prefix . '.js' );
			}
		}

User Contributed Notes

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