Feature Request - Looper Filtering

Hi Charlie,

I trust you are well. Been having a few thoughts on a new project and filtering via loopers is a thought - rather than having to go down the WPFacet / Search and Filter route. Loopers are already immensely powerful, so how simple (or not!) would it be to use them for front-end filtering?

An idea of this is:

<!-- Filter Controls -->
<div class="project-filters">
  <select id="filter-type" data-looper-param="project_type">
    <option value="">All Types</option>
    <option value="residential">Residential</option>
    <option value="heritage">Heritage & Listed</option>
    <option value="sustainable">Sustainable</option>
    <option value="commercial">Commercial</option>
  </select>
  
  <select id="filter-location" data-looper-param="location">
    <option value="">All Locations</option>
    <option value="bath">Bath</option>
    <option value="frome">Frome</option>
    <option value="wells">Wells</option>
  </select>
  
  <button id="reset-filters">Reset</button>
</div>

<!-- Cornerstone Looper -->
<!-- How do we make this looper respond to the filter changes above? -->
<div class="projects-grid">
  [Looper Provider - filtered by parameters?]
    [Looper Consumer - project cards]
  [/Looper]
</div>

<script>
// When filter changes, how do we update the looper query?
document.querySelectorAll('.project-filters select').forEach(select => {
  select.addEventListener('change', function() {
    // Update looper here - what's the Cornerstone way?
    updateLooper();
  });
});
</script>

Is this something, which could be done either as a new CS feature, or by us, end users, in some way?

Many thanks,
Christopher

5 Likes

Cornerstone Forms is going to contain most of our Looper filtering features. It’ll also have AJAX support for filtering. From what you have there if you give your form fields a name attribute, you can reference that via the Query String Parameter dynamic content using that same name attribute. You can then pass that dynamic content into the Query builder looper. Have a great day.

2 Likes

Yes forms has been the main feature request been looking forward to this year lots of places this can be used.

1 Like

Hi Charlie,

Crikey, that is quite something! When does CS Forms hit beta? For my current project (not what we have been discussing elsewhere), it could be a game-changer.

Many thanks,
Christopher

1 Like

We’re doing testing internally with users soon before a larger beta. It’s admittedly a little hard to use given all you can do with it, so we’ll be working with you all to get a system we can all enjoy.

3 Likes

Awesome news Charlie! This will be a game chnager. Cant wait to try it out in the beta!

Best regards
Harald

Wow, that looks very powerful! really looking forward to that

I can’t wait! I was looking through the forum for Filter solution and stumbled on this post. Sounds like an exciting new feature!

Another insanely powerful feature. It may be able to replace FacetWP.

1 Like