Last active
October 30, 2022 05:44
-
-
Save robertstaddon/756953cd155f3a19a4b3b3c0d116585d to your computer and use it in GitHub Desktop.
Turn Astra Secondary Menu into LiteSpeed ESI Block
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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