When I tried to use add_filter( ‘bricks/setup/control_options’)… the issue with this is that you end up unable to use the live search as far as I can tell. But it can work if you don’t need live search.
SOLUTION add_filter( 'bricks/query/result): Played around with it, tried different things, but I think I got it work. In bricks create your live search and just add the 2 Posts and complete your setting as you like…… then use this filter to manipulate the returned results.
Here’s my code snippet, works good so far:
add_filter( 'bricks/query/result', function( $result, $query_obj ) {
//error_log( print_r( $result, true ) );
//return $result;
if ( $query_obj->element_id !== 'qiidxf' || $query_obj->object_type !== 'post' ){
return $result;
}
...
...
... //manipuate the result here. to your desired needs.
...
// Important Update post count and found posts based on the modified posts array.
$result->post_count = count( $result->posts );
$result->found_posts = $result->post_count;
//error_log( print_r( $result->posts, true ) );
return $result;
}, 10, 2 );