Greenshift Visibility Block filtering via PHP conditions
<?php
add_filter('render_block', 'custom_visibility_conditions_check', 11, 2);
// Don't forget to specify block ID and the CPT slugs in $allowed_post_types
function custom_visibility_conditions_check($block_content, $block){
if(isset($block['attrs']['id']) && $block['attrs']['id'] == 'gsbp-xxxxxxx') {
$allowed_post_types = array('books', 'movies');
if(is_singular($allowed_post_types)){
return $block_content;
} else {
return '';
}
}
return $block_content;
}
Comments
0 B
|👍
/👎
0 B
|👍
/👎