Skip to content

8. Filtering properties

Falko Joseph edited this page Mar 4, 2021 · 2 revisions

Filtering properties

How to get the search results?

You can filter properties by configuring the WP_SweepBright_Query::list method.

Example implementations

1. Plain PHP

You can render the search results server side by setting the filter and sort arguments from list() in PHP. This is probably the easiest way, but it's a little less user friendly, since it requires a full page reload when applying a filter.

2. Javascript (recommended)

If you want to have a dynamic search filter that doesn't require a full page reload you can call the list() method from an API. You're free to decide on how to implement it.

The returned search results can be transformed to plain JSON object, so your JavaScript front-end can render it on the fly. This allows for a smoother user experience.

Clone this wiki locally