Hello everyone!
I have the following problem:
I have a query loop with an offset of 1 post (I display the last post in another place), but when I apply a filter to this loop, the first post in the filter results also hides. In short, after applying the filter, I need to remove this offset somehow so that all the results are shown.
I tried but it didn’t work for some reason. But this was my idea, maybe you can build on it:
add_filter('bricks/posts/query_vars', function ($query_vars, $settings, $element_id, $element_name) {
if ($element_id !== 'yhfzif') return $query_vars;
if (bricks_is_rest_call()) {
unset($query_vars['offset']);
}
return $query_vars;
}, 10, 4);
Maybe you can try something like this with another bricks filter like bricks/query/result
.
Hope this helps
Cheers Suat
1 Like
Instead of bricks_is_rest_call()
, can use \Bricks\Api::is_current_endpoint('query_result')
Thanks, guys, but I didn’t manage to make it work