Hi everyone!
I’m working on a Bricks Builder project where I’m using a Query Loop to display custom posts, and it works great on page load. But now I’d like to re-run that query dynamically using AJAX for example, when a user clicks a button to reload or filter results without refreshing the page.
Since the Bricks query loop only runs once on initial page load, is there a clean way to trigger the same loop again via AJAX, or do I need to manually recreate the query in PHP and return the results?
(I don’t want to use the live - search or filter elements since they are limiting in what filtering logic I can use)
Would love to hear how others are doing this:
- Do you create a custom wp_ajax_ endpoint?
- Do you render the loop item layout using get_template_part()?
- Is there a Bricks-native or more integrated approach I’m missing?
Thanks in advance!