How to pre-filter results on a View
There are two ways possible to pre-filter your View results:
By using the `search_field` and `search_value` parameters from the [gravityview] shortcode
Pros: Ability to change the value used to filter results just by changing the
search_value parameter. This way, you will need to create only one View configuration without filters that you can embed on multiple pages, using different filters.
Cons: You can only filter by one value at a time. To filter by multiple values, you will need to use the Advanced Filter extension (see below).
To learn more about how to pre-filter results using these two parameters (
search_value), check out this article: Using the [gravityview] Shortcode
Here's an advanced tip: if you want to programatically change the
search_value parameter based on the page the View is embedded on using a variable, you can call the
[gravityview] shortcode directly on the PHP template of your page.
echo do_shortcode('[gravityview id="12" search_field="3" search_value="'.$value.'"]');
By using the Advanced Filters extension
If you have our Advanced Filter extension installed, you'll see this new section on your View Settings metabox:
You can configure mutliple filters to specify precisely the entries you want displayed.
Pro: You can specify several different rules to narrow down your results. You also have the power of the search operators: Any or All.
The "Any" operator means that whatever condition results in true, it will filter by that rule. The "All" operators means that all the conditions specified needs to be "true" in order for the entries to be displayed.
Cons: The rules will