Hi @vivicheruti,
Content Visibility for Divi Builder also comes equipped with a myriad of action and filter hooks. The documentation for them lives in the WordPress backend at /wp-admin/tools.php?page=module-extender-for-divi-builder-api-reference
I believe what you are looking for is content_visibility_for_divi_builder_shortcode_$tag, which lets you filter the result of a module’s shortcode based on its shortcode tag. So, for example, if you wanted to do something when a contact form module’s output has been blanked out due to the visibility expression being false:
add_filter( 'content_visibility_for_divi_builder_shortcode_et_pb_contact_form', function( $result, $atts, $content, $function_name, $et_pb_element, $et_pb_shortcode_callback ) {
if ($result === '') {
// This module has been blanked out; you may want to check this specific module is on the correct page, or has the correct id attribute, since this will fire for ALL instances of the module on your site
$result = '<p>Some other html to show instead</p>';
}
return $result;
}, 1338, 6 ); // 1338 or higher priority required to fire after content visibility for divi builder has evaluated the visibility expression
Thread Starter
Viviana
(@vivicheruti)
Thank u Jonathan for your super quick answer!
That’s what I was looking for!