). * * @since 3.0.0 * @var Array */ $menu_classes = apply_filters( 'astra_' . $theme_location . '_menu_classes', array( 'main-header-menu', 'ast-menu-shadow', 'ast-nav-menu', 'ast-flex', $submenu_class, $stack_on_mobile_class ) ); $items_wrap = ''; // Generate a unique menu ID based on context. $unique_suffix = ''; if ( 'desktop' !== $device ) { $unique_suffix = '-' . $device; } // Fallback Menu if primary menu not set. $fallback_menu_args = array( 'theme_location' => $theme_location, 'menu_id' => apply_filters( 'astra_header_menu_ul_id', 'ast-hf-menu-' . $index . $unique_suffix ), 'menu_class' => 'main-navigation ast-inline-flex', 'container' => 'div', 'before' => '', 'walker' => new Astra_Walker_Page(), 'echo' => false, ); // To add default alignment for navigation which can be added through any third party plugin. // Do not add any CSS from theme except header alignment. echo '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped if ( is_customize_preview() ) { Astra_Builder_UI_Controller::render_customizer_edit_button(); } if ( has_nav_menu( $theme_location ) ) { /** @psalm-suppress ArgumentTypeCoercion */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $nav_menu_markup = wp_nav_menu( array( 'menu_id' => apply_filters( 'astra_header_menu_ul_id', 'ast-hf-menu-' . $index . $unique_suffix ), 'menu_class' => esc_attr( implode( ' ', $menu_classes ) ), 'container' => 'div', 'container_class' => 'main-header-bar-navigation', 'items_wrap' => $items_wrap, 'theme_location' => $theme_location, 'echo' => false, ) ); // Adding rel="nofollow" for duplicate menu render. $nav_menu_markup = $astra_builder->nofollow_markup( $theme_location, $nav_menu_markup ); echo do_shortcode( $nav_menu_markup ); /** @psalm-suppress ArgumentTypeCoercion */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort } else { echo '
'; echo ''; echo '
'; } echo '
'; } } /** * Kicking this off by creating an object. */ new Astra_Header_Menu_Component();