Astra_Ext_Header_Sections_Markup::astra_get_above_header_items()

Custom Above Header Menu Item Markup


Description

=> Used in hooks:

See also


Source

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

		public function astra_get_above_header_items() {
			if ( function_exists( 'ubermenu_automatic_integration_filter' ) ) {
				remove_filter( 'wp_nav_menu_args', 'ubermenu_automatic_integration_filter', 1000 );
			}
			$markup = '';

			// Above Header Menu nmerged with Primary Menu for resonsive devices.
			$above_header_menu_args = array(
				'theme_location' => 'above_header_menu',
				'container'      => false,
				'fallback_cb'    => false,
				'echo'           => true,
				'items_wrap'     => '<ul class="ast-above-header-menu-items"> %3$s </ul>',
			);

			$mobile_menu_style = astra_get_option( 'mobile-menu-style' );

			// If menu style is no toggle, remove item wrap div from above header menu.
			if ( 'no-toggle' == $mobile_menu_style ) {
				$above_header_menu_args['items_wrap'] = '%3$s';
			}

			$above_header_on_mobile = astra_get_option( 'above-header-on-mobile' );

			$above_header_enabled     = $this->astra_above_header_enabled();
			$above_header_layout      = astra_get_option( 'above-header-layout' );
			$above_header_layout_meta = astra_get_option_meta( 'ast-above-header-display' );

			// Above Header is merged with primary menu.
			if ( $this->astra_above_header_merged_enabled() && $above_header_on_mobile ) {
				ob_start();

				if ( has_nav_menu( 'above_header_menu' ) ) {

					if ( $above_header_enabled ) {

						$above_section_1 = astra_get_option( 'above-header-section-1' );
						$above_section_2 = astra_get_option( 'above-header-section-2' );

						if ( ( 'menu' === $above_section_1 && 'above-header-layout-1' === $above_header_layout ) || ( 'menu' === $above_section_2 && 'above-header-layout-1' === $above_header_layout ) || ( 'menu' === $above_section_1 && 'above-header-layout-2' === $above_header_layout ) ) {

								wp_nav_menu( $above_header_menu_args );
						}
					}
				}
				$markup = ob_get_clean();
			}
			if ( function_exists( 'ubermenu_automatic_integration_filter' ) ) {
				add_filter( 'wp_nav_menu_args', 'ubermenu_automatic_integration_filter', 1000 );
			}
			return apply_filters( 'astra_get_above_header_items', $markup );
		}

Changelog

Changelog
Version Description
1.0.0 Introduced.


User Contributed Notes

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