astra_masthead_get_menu_items( boolean $display_outside_markup = false )
Custom Menu Item Markup
Description
=> Used in hooks:
See also
Parameters
- $display_outside_markup
-
(boolean) (Optional) Outside / Inside markup.
Default value: false
Source
File: inc/template-parts.php
function astra_masthead_get_menu_items( $display_outside_markup = false ) { // Get selected custom menu items. $markup = ''; $section = astra_get_option( 'header-main-rt-section' ); $sections = astra_get_dynamic_header_content( 'header-main-rt-section' ); $disable_primary_navigation = astra_get_option( 'disable-primary-nav' ); $html_element = 'li'; if ( $disable_primary_navigation || $display_outside_markup ) { $html_element = 'div'; } if ( array_filter( $sections ) ) { ob_start(); $menu_item_classes = apply_filters( 'astra_masthead_custom_menu_item', array( 'ast-masthead-custom-menu-items', $section . '-custom-menu-item' ), $section ); ?> <<?php echo esc_attr( $html_element ); ?> class="<?php echo esc_attr( join( ' ', $menu_item_classes ) ); ?>"> <?php foreach ( $sections as $key => $value ) { if ( ! empty( $value ) ) { echo $value; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } ?> </<?php echo esc_attr( $html_element ); ?>> <?php $markup = ob_get_clean(); } return apply_filters( 'astra_masthead_get_menu_items', $markup ); }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |