add_filter('bricks/posts/query_vars', function($query_vars, $settings, $element_id) {
// Replace 'my_element_id' with the ID of your Bricks element
if ($element_id === 'my_element_id') {
// Check if the 'data_sale-item' switch is set to 'on' or '1'
$is_sale_item = isset($_GET['sale_item']) ? sanitize_text_field($_GET['sale_item']) : '';
if ($is_sale_item === '1') {
$query_vars['meta_query'][] = [
'key' => 'data_sale-item',
'value' => '1', // Assuming '1' indicates the switch is ON
'compare' => '=',
];
} elseif ($is_sale_item === '0') {
$query_vars['meta_query'][] = [
'key' => 'data_sale-item',
'value' => '0', // Assuming '0' or empty indicates the switch is OFF
'compare' => '=',
];
}
}
return $query_vars;
}, 10, 3);
- 20 x 16 cm
- 20 x 16 cm
- 35 x 65 cm
- cm
- 20 x 16 cm
- 20 x 16 cm