not sure what kind of template you refer to , but I got another example I made long time ago , see if it helps you
<?php
/*
Plugin Name: LiteSpeed Cache Plugin ESI
Description: LiteSpeed ESI test
*/
defined('WPINC') || exit;
if (!defined('LSCWP_V') || ! apply_filters( 'litespeed_esi_status', false ))
{
return;
}
add_action( 'litespeed_esi_load-my_esi_block', 'my_esi_block_esi_load' );
function my_esi_block_esi_load()
{
do_action( 'litespeed_control_set_nocache' );
echo "Hello world: ".rand (1,99999);
}
add_action('wp_head', 'lscwp_esi_test');
add_action('wp_footer', 'lscwp_esi_test');
function lscwp_esi_test() {
echo '<div style="background: blue; color: white; text-align: center;">';
echo apply_filters( 'litespeed_esi_url', 'my_esi_block', 'Custom ESI block' );
echo '</div>';
}
this works as a plugin , and add a random number in header and footer as example case.
basically , for whereever you want to display content , you echo out the apply_filters( 'litespeed_esi_url', 'my_esi_block', 'Custom ESI block' )
and then create a corresponding function, somewhere is called before apply_filters , in above example , I called ESI function like few lines before as demonstration.