Source – WPForms
WPForms is the leading drag-and-drop form builder plugin for WordPress. It’s widely recognized for its user-friendly interface and powerful capabilities. This Extension enables you to utilize WPForms entries as a custom Source for SearchWP, making it possible to search WPForms entries with SearchWP!
Adding WPForms Entries to SearchWP’s Index
Once the SearchWP Source – WPForms extension has been installed and activated, your forms by WPForms will appear in the Sources list for your SearchWP Engine.
Note: This custom Source can be used only with a Supplemental Engine.
Let’s say you were building a Suggestion request area on your website and using WPForms Suggestion Form to collect entries.
You could utilize SearchWP to allow customers to first search existing entries before submitting their own, so they could join in up-voting the existing submission instead of creating a duplicate.
The first step would be to create a new Supplemental Engine that has our Suggestion Form as the Source:
Please note that you can add multiple forms by WPForms to the same engine if you want.
Once the form has been added to the SearchWP engine, all the searchable form fields are added as attributes to the engine source. You can click on Add/Remove Attributes to change the list of fields you want to search.
Displaying WPForms Entries as Results
The SearchWP Source – WPForms Extension will make available WPForms Entries as search results. This integrates as any Source would when working with a Supplemental Engine.
Unlike a native WordPress search that has The Loop which is an array of WP_Post
objects that WordPress’ API interacts with, the results set for a Supplemental Engine can be made up of any SearchWP Source object.
WPForms uses a stdClass for Form Entries. As a convenience, SearchWP Source – WPForms will return results in a wrapper object:
\SearchWP\Sources\WPForms\Entry
This will help as you iterate over your results array:
Note: You can prevent SearchWP from wrapping results in the class and return instead a stdClass with the following hook:
SearchWP Source – WPForms allows you to make any WPForms Entry searchable using SearchWP! You can make as many SearchWP Engines with as many WPForms Sources as you’d like, each with their own configuration of Fields. Use SearchWP’s capable search algorithm to make your WPForms Entries searchable!