Astra_Ext_Header_Sections_Markup::get_below_header_section( string $section, string $layout = '' )
Get Below Header Section
Description
Parameters
- $section
-
(string) (Required) Below Header Section.
- $layout
-
(string) (Optional) Below Header Layout.
Default value: ''
Return
(void)
Source
File: addons/header-sections/classes/class-astra-ext-header-sections-markup.php
public static function get_below_header_section( $section, $layout = '' ) { $section_class = $section . ' ast-flex ast-justify-content-center'; /** * Filter the classes(array) for Below Header Menu (<ul>). * * @since 1.6.0 * @var Array */ $below_header_menu_classes = apply_filters( 'astra_below_header_menu_classes', array( 'ast-below-header-menu', 'ast-nav-menu', 'ast-flex' ) ); // Menu Animation. $menu_animation = astra_get_option( 'below-header-submenu-container-animation' ); if ( ! empty( $menu_animation ) ) { $below_header_menu_classes[] = 'astra-menu-animation-' . esc_html( $menu_animation ); } if ( 'below-header-1' == $layout ) { $section_class = $section . ' ast-flex ast-justify-content-flex-start'; $below_header_menu_classes[] = 'ast-justify-content-flex-start'; if ( 'below-header-section-2' == $section ) { $section_class = $section . ' ast-flex ast-justify-content-flex-end'; $below_header_menu_classes[] = 'ast-justify-content-flex-end'; } } else { $below_header_menu_classes[] = 'ast-justify-content-center'; } $value = astra_get_option( $section ); if ( 'below-header-section-1' == $section ) { $below_header_widget = 'below-header-widget-1'; $below_header_menu_id = 'ast-below-header-navigation-section-1'; } if ( 'below-header-section-2' == $section ) { $below_header_widget = 'below-header-widget-2'; $below_header_menu_id = 'ast-below-header-navigation-section-2'; } // Submenu with border class. $below_header_menu_classes[] = 'submenu-with-border'; switch ( $value ) { case 'menu': echo '<div class="ast-below-header-navigation ' . esc_attr( $section_class ) . '">'; do_action( 'astra_below_header_toggle_buttons' ); if ( has_nav_menu( 'below_header_menu' ) ) { /** * Fires before the Below Header Menu * * @since 1.4.0 */ do_action( 'astra_below_header_before_menu' ); wp_nav_menu( array( 'container' => 'nav', 'container_class' => 'ast-below-header-actual-nav navigation-accessibility', 'container_id' => $below_header_menu_id, 'theme_location' => 'below_header_menu', 'menu_id' => 'below_header-menu', 'menu_class' => esc_attr( implode( ' ', $below_header_menu_classes ) ), ) ); /** * Fires after the Below Header Menu * * @since 1.4.0 */ do_action( 'astra_below_header_after_menu' ); } else { if ( is_user_logged_in() && current_user_can( 'edit_theme_options' ) ) { echo '<a href="' . esc_url( admin_url( '/nav-menus.php?action=locations' ) ) . '">' . esc_html__( 'Assign Below Header Menu', 'astra-addon' ) . '</a>'; } } echo '</div>'; break; case 'search': case 'text-html': $sections = astra_get_dynamic_header_content( $section ); if ( is_array( $sections ) && 0 < count( $sections ) ) { echo '<div class="below-header-user-select ' . esc_attr( $section_class ) . '">'; foreach ( $sections as $key => $value ) { echo '<div class="user-select">'; echo $value; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo '</div>'; } echo '</div>'; } break; case 'widget': echo '<div class="below-header-widget below-header-user-select ' . esc_attr( $section_class ) . '">'; astra_get_sidebar( $below_header_widget ); echo '</div>'; break; default: $output = apply_filters( 'astra_get_dynamic_header_content', '', $section, $value ); if ( ! empty( $output ) ) { echo '<div class="below-header-user-select ' . esc_attr( $section_class ) . '">'; echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo '</div>'; } } }
Expand full source code Collapse full source code View on Trac