I wrote this function to customize a divi theme module through a specific theme hook, this works but I want to apply this only to the custom post type strutture, but my if statement is always returning true, so the module is customized on all the pages with that module and not only to the struttura custom post type. Any suggestions?
add_filter('et_pb_module_shortcode_attributes', 'galleria_divi_acf', 20, 3);
function galleria_divi_acf($props, $atts, $slug) {
$gallery_module_slugs = array('et_pb_gallery');
if (!in_array($slug, $gallery_module_slugs)) {
return $props;
}
if (is_singular( 'struttura' )) {
$props['gallery_ids'] = get_field('galleria_struttura', false, false);
return $props;
}
}