By default, the Conditional Module present throughout the theme, in places such as the header customiser, Content Blocks and more, has the relation of OR
between its conditions.
But, because some use cases rely on the relation to be AND
between the conditions, we’ve implemented some filters that help you do this.
Content Blocks
Use this little snippet to change the relation for a Content Block. Replace the ID with yours.
add_filter(
'blocksy:pro:content-blocks:condition-match-args',
function ($args, $id) {
$desired_hook_id = 15;
if ($id === $desired_hook_id) {
$args['relation'] = 'AND';
}
return $args;
},
10, 2
);
Headers
Same can be done for multiple headers. Match it by the header name, or by it’s ID, taken from the DOM.
add_filter('blocksy:pro:header:condition-match-args', function ($args, $single_section) {
// Match by header name that was used during creation
// Or match by header ID but it's harder to find that one.
if ($single_section['name'] === 'My header') {
$args['relation'] = 'AND';
}
return $args;
}, 10, 2);