Skip to content

Instantly share code, notes, and snippets.

@robertstaddon
Last active October 30, 2022 05:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save robertstaddon/756953cd155f3a19a4b3b3c0d116585d to your computer and use it in GitHub Desktop.
Turn Astra Secondary Menu into LiteSpeed ESI Block
<?php
add_filter( 'wp_nav_menu', function( $nav_menu_html, $args ) {
if ( $args->menu_id == "ast-hf-menu-2" ) {
if ( apply_filters( 'litespeed_esi_status', false ) )
return apply_filters( 'litespeed_esi_url', 'astra_secondary_menu', 'Secondary Menu', array( 'nav_menu_html' => $nav_menu_html, 'args' => $args ), $control = 'private,no-vary', $silence = false );
}
return $nav_menu_html;
}, 10, 2);
add_action( 'litespeed_esi_load-astra_secondary_menu', function ( $atts ) {
echo $atts['nav_menu_html'];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment