Views: Frontend Filter and Sort

By: Michael Clark | Asked: 05/17/2024
ForumsCategory: General questionsViews: Frontend Filter and Sort
Michael ClarkMichael Clark asked 2 months ago
  • How can I let a user search, filter, and sort by clicking radio buttons?
  • Is there a way other than creating a custom search form?
2 Answers
Rob LeVineRob LeVine answered 2 months ago
I'm not 100% sure what you mean, however Datatables offers all sorts of ways to extend a table with filtering, sorting, etc.
Michael ClarkMichael Clark replied 2 months ago

Thanks, @Rob LeVine. I appreciate the suggestion. Datatables is indeed impressive. The UX I've designed had UI elements that are grid driven, not tabluar. I could absu=olutely change things up to use this, though, for sure.

Increasingly, I'm hitting a wall where I need to introduce more and more custom code to get the fundamental experience and functionality I require. Not a bd thing, but as a soloist, I have to consider the costs of maintaining, fixing, and scaling things. Hence why I was wondering if there was a simple, perhaps documented but not easy to get at way of handling this natively. Looks like custom search is the way, unless I build this outside of WP altogether and then make it an integration.

Bobby Clapp answered 2 months ago

It's not built in functionality. The answer is jQuery and CSS, however you could just use something like datatables. https://formidable-masterminds.com/downloads/datatables-w-searchpanes/

Search is not necessarily a "button" action. Filter and sort can be done via the above.

Michael ClarkMichael Clark replied 2 months ago

Thanks, @Bobby Clapp. Appreciate the suggestion.

Bobby Clapp replied 2 months ago

Sure. Here is some quick pulled example I'm using for "grid" style stuff, if it might help you:

https://codepen.io/Dgodfather-Administrator/pen/xxNVQoX

Not perfect and not styled, but something you can use for guidance.

Michael ClarkMichael Clark replied 2 months ago

Wow. Thanks, @Bobby Clapp! I'm not sure how to implement this, but if I figure it out how to do the buttons (simple css-styled Button Name , or an actual html button tag?) and if/how to do the onClick event, I'll definitely give this a shot!

Bobby Clapp replied 2 months ago

Give it a whirl. Sometimes people just need example code to play with. This is a bit overkill, because it has all of my CSS for my website, but you could break it down and manipulate it to work. I've just got some CSS styling an anchor to look like a button for the "filter buttons".

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right