Oh, I get it now, so a function can be ESI and the initial code doesn’t necessarily need to be ESI
Can you tell me how to ESI another part of that page? I need to add two “add_action” to the function?
example for first block:
echo apply_filters( 'litespeed_esi_url', 'my_esi_block', 'Custom ESI block' );
and add this to function.php:
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' );
az_product_price_woo( get_the_ID() );
az_add_product_woo( get_the_ID() );
}
then for second block:
echo apply_filters( 'litespeed_esi_url', 'my_esi_block_second', 'Custom ESI block' );
and add this to function.php:
add_action( 'litespeed_esi_load-my_esi_block_second', 'my_esi_block_second_esi_load' );
function my_esi_block_second_esi_load()
{
do_action( 'litespeed_control_set_nocache' );
my code
}
Its true? Can’t it be optimized? To have only one add_action for example?
Plugin Support
qtwrk
(@qtwrk)
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' );
// your code for block 1
}
add_action( 'litespeed_esi_load-my_esi_block2', 'my_esi_block2_esi_load' );
function my_esi_block2_esi_load()
{
do_action( 'litespeed_control_set_nocache' );
// your code for block 2
}
apply_filters( 'litespeed_esi_url', 'my_esi_block', 'Custom ESI block 1' );
// where you put block 1 output
apply_filters( 'litespeed_esi_url', 'my_esi_block2', 'Custom ESI block 2' );
// where you put block 2 output
something like that