Configuring the (WordPress) Search Widget
This is really helpful if you want to allow users to search your directory from anywhere on your website.
What Is the WordPress Search Widget?
The WordPress search widget allows you to search entries in a specific View on your website. You can configure it just as you would configure the regular GravityView Search Bar inside your View.
The WordPress Search Widget Is NOT the Same as the GravityViewSearch Bar Widget
GravityView’s Search Bar widget is a widget that you can add to your Views from inside the View editor.
On the other hand, the WordPress Search widget is not confined to a View! You can add it to your sidebar, footer or any widget area. This allows you to display a GravityView search bar anywhere on your site.
Use the WordPress Search widget if you want to:
- Display a GravityView search bar on a page where there isn’t a View
- Display a search bar in your sidebar or footer area
- Allow users to search your directory from any page on your website
- Showcase a different search bar for two or more separate Views
Configuring the WordPress Search Widget
Hover over Appearance and click Widgets. Open one of the available widget areas (e.g. the Sidebar) and click on the ‘+’ icon to add a new widget. Now search for “GravityView” and select the “GravityView Search” widget.
After adding the widget to a widget area on your website, click on it to configure the search functionality.
- The title of the search widget, displayed above the search input boxes
- The View that you want to search
- If you want users to search entries from an embedded View, you’ll need to add the page or post ID here where the View is embedded
- Show the “clear” button, allowing users to clear a search
- Choose how you want your search bar to operate. You can set searches to match any field or only one field
- Add multiple search input fields based on the fields in your form
Check out this helpful article for guidance on how to find your page or post ID in WordPress.
Configuring Search Fields
You can add multiple search fields to the search widget. To add a new field, click on the ‘+’ icon and select a field from your form to add. You can reorder search fields by dragging and dropping them.
Some fields allow for different input types. For example, fields with multiple choices can be displayed as either Select, Radio Buttons or Links.
Choose one value at a time from a drop-down list
Allows one search value at a time by selecting it using a checkbox
The Links search type displays a list of links to filter by a specific value. When the filter is clicked, the active filter is bolded.
In this example, we’ve added a GravityView Search widget to our sidebar, allowing users to search for entries in our business directory.