Astra_Ext_Header_Sections_Markup::astra_masthead_get_menu_items( array $items )

Header Sections content if Primary Menu disabled and Custom menu item is not none


Description


Parameters

$items

(array) (Required) Nav menu item array.


Source

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

		public function astra_masthead_get_menu_items( $items ) {
			$disable_primary_navigation = astra_get_option( 'disable-primary-nav' );
			$custom_header_section      = astra_get_option( 'header-main-rt-section' );
			$above_header               = $this->astra_above_header_enabled();
			$below_header               = $this->astra_below_header_enabled();

			$display_outside_menu   = astra_get_option( 'header-display-outside-menu' );
			$above_header_on_mobile = astra_get_option( 'above-header-on-mobile' );
			$below_header_on_mobile = astra_get_option( 'below-header-on-mobile' );

			if ( ( $above_header || $below_header ) && ( $above_header_on_mobile || $below_header_on_mobile ) ) {
				if ( $disable_primary_navigation && ( 'none' != $custom_header_section && ! $display_outside_menu ) ) {
					$above_header_markup = $this->astra_get_above_header_items();
					$below_header_markup = $this->astra_get_below_header_items();
					$items               = $above_header_markup . $below_header_markup . $items;
				} elseif ( $disable_primary_navigation && 'none' != $custom_header_section && $display_outside_menu ) {
					// Disable Primary menu,
					// Custom Menu Item & Take custom menu item outside enabled,
					// Merge Above Header menu with primary menu in responsive,
					// Merge Below Header menu with primary menu in responsive.
					// for all above condition add a primary menu wrapper class to the Above Header & Below Header menu.
					$above_header_markup = $this->astra_get_above_header_items();
					$below_header_markup = $this->astra_get_below_header_items();

					$nav_wrap       = apply_filters(
						'astra_merge_header_custom_menu_item_wrap',
						'<div class="main-header-bar-navigation ast-header-sections-navigation">
						<nav itemtype="https://schema.org/SiteNavigationElement" itemscope="itemscope" id="site-navigation" class="ast-flex-grow-1 navigation-accessibility" aria-label="' . esc_attr__( 'Site Navigation', 'astra-addon' ) . '">'
					);
					$nav_wrap_close = apply_filters( 'astra_merge_header_before_custom_menu_item', '</div></nav>' );

					$items = $nav_wrap . $above_header_markup . $below_header_markup . $nav_wrap_close . $items;
				}
			}
			return $items;
		}

Changelog

Changelog
Version Description
1.0.0 Introduced.


User Contributed Notes

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