Home › Forums › General Issues › filtering by custom field entry › Reply To: filtering by custom field entry
This is what you need to do:
1. Create a select field with the options
2. Write some jQuery to trigger a function on change of this select
3. Get the JS function to do an AJAX call to a WP ajax function
4. Create this WP ajax function in your functions.php
5. Get your JS to post the selected value to the php function
6. Get your php function to use this value to filter the posts and return the correct data
7. Get your js function to use this data on complete.
You will find a tutorial in the docs on querying the posts based on a custom field value, the rest is up to you and google.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.