Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter results with a category dropdown menu #51

Open
bbdetail opened this issue Aug 30, 2016 · 0 comments
Open

Filter results with a category dropdown menu #51

bbdetail opened this issue Aug 30, 2016 · 0 comments
Labels

Comments

@bbdetail
Copy link

Hi, I'm loving this plugin, thanks very much.

I've added a dropdown menu beside the search box in searchform.php containing all my categories.

Could you point me in the right direction on how I can pass the dropdown category value onChange and initiate the AJAX search?

I know how to manually filter categories with searchwp_live_search_query_args but I'm not sure how to pass the dropdown value to that on-the-fly.

Any pointers would be appreciated. Thanks.

pjv added a commit to pjv/searchwp-live-ajax-search that referenced this issue Apr 24, 2020
This PR lets you modify the search query for **native WP search** by adding hidden form fields to the search form like

`<input type="hidden" name="posts_per_page" value="20">`

or

`<input type="hidden" name="post_types" value="post,product">`

or

`<input type="hidden" name="cat" value="1,17,126">`

or

`<input type="hidden" name="category_name" value="books">`

This allows you to do some basic filtering and tuning on a *form by form* basis, as opposed to using the `searchwp_live_search_query_args` filter or the `searchwp_live_search_posts_per_page` filter which operate on all forms.

This PR yields a simple-ish solution for issues:
jchristopher#51 jchristopher#86 jchristopher#75 jchristopher#31 jchristopher#115.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants