Skip to content

Snippet: Add the Header Aside Content to the Bottom of the Mobile Menu

If you want to automatically insert the same code added to your header aside area to the bottom of your mobile menu you can do so using the following snippet:

/**
 * Insert header aside to mobile menu bottom.
 */
add_action( 'wpex_hook_mobile_menu_bottom', function() {
	if ( totaltheme_call_static( 'Header\Core', 'has_flex_container' ) ) {
		$header_aside = totaltheme_call_static( 'Header\Flex\Aside', 'get_content' );
	} else {
		$header_aside = totaltheme_call_static( 'Header\Aside', 'get_content' );
	}
	if ( $header_aside ) {
		echo '<div class="mobile-menu-aside">' . do_shortcode( wp_kses_post( $header_aside ) ) . ' </div>';
	}
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin.
We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top