Astra_Ext_Header_Sections_Markup::above_header_menu( string $option )

Function to get Above Header Menu


Description


Parameters

$option

(string) (Required) Above Header Menu Option.


Return

(mixed)


Source

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

		public static function above_header_menu( $option ) {

			/**
			 * Filter the classes(array) for Above Header Menu (<ul>).
			 *
			 * @since  1.6.0
			 * @var Array
			 */
			$above_header_menu_classes = apply_filters( 'astra_above_header_menu_classes', array( 'ast-above-header-menu', 'ast-nav-menu', 'ast-flex' ) );

			// Menu Animation.
			$menu_animation = astra_get_option( 'above-header-submenu-container-animation' );
			if ( ! empty( $menu_animation ) ) {
				$above_header_menu_classes[] = 'astra-menu-animation-' . esc_html( $menu_animation );
			}

			if ( 'above-header-section-2' == $option ) {
				$above_header_menu_classes[] = 'ast-justify-content-flex-end';
				$above_header_menu_id        = 'ast-above-header-navigation-section-2';
			} else {
				$above_header_menu_classes[] = 'ast-justify-content-flex-start';
				$above_header_menu_id        = 'ast-above-header-navigation-section-1';
			}

			// Submenu with border class.
			$above_header_menu_classes[] = 'submenu-with-border';

			ob_start();

			do_action( 'astra_above_header_toggle_buttons' );

			if ( has_nav_menu( 'above_header_menu' ) ) {

				/**
				 * Fires before the Above Header Menu
				 *
				 * @since 1.4.0
				 */
				do_action( 'astra_above_header_before_menu' );

				wp_nav_menu(
					array(
						'container'       => 'div',
						'container_class' => 'ast-above-header-navigation navigation-accessibility',
						'container_id'    => $above_header_menu_id,
						'theme_location'  => 'above_header_menu',
						'id'              => 'above_header-menu',
						'menu_class'      => esc_attr( implode( ' ', $above_header_menu_classes ) ),
						'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
					)
				);

				/**
				 * Fires after the Above Header Menu
				 *
				 * @since 1.4.0
				 */
				do_action( 'astra_above_header_after_menu' );

			} else {
				if ( is_user_logged_in() && current_user_can( 'edit_theme_options' ) ) {
					?>
					<a href="<?php echo esc_url( admin_url( '/nav-menus.php?action=locations' ) ); ?>"><?php esc_html_e( 'Assign Above Header Menu', 'astra-addon' ); ?> </a>
						<?php
				}
			}

			return ob_get_clean();
		}


User Contributed Notes

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