How to display facets on your pages
The search forms extension displays the facets and other search and sorting elements through shortcodes. Each shortcode found into this extension is covered below here.
These shortcodes can be added to the content of your pages, posts and text widgets. Our own live demo uses widgets to display the facets in some places. If you're using the Gutenberg editor, you can add shortcodes by using the shortcodes block.
Display facet shortcode
This is the shortcode used to display the individual form elements that will compose your full search form. To display a specific facet, you must pass it's ID number into the "facet" parameter just like in the example above. The ID number of each facet can be found into the "Listings → Search forms" page in your admin panel.
Display faceted pagination
In addition to the default pagination included with Posterno, the search addon brings a new ajax pagination. This is particularly useful if you're building custom layouts with page builders or manually coding it.
Display a results amount modifier
The amount modifier allows users on your website to increase or decrease the amount of results displayed when they perform a search. This is an additional modifier powered by ajax particularly useful if you're building custom layouts with page builders or manually coding it.
Display a results sorter
In addition to the default results sorter, an ajax powered sorter has been included with the extension. Particularly useful if you're building custom layouts with page builders or manually coding it.
Display the total number of results
If you wish to display the total number of results found through a search query, you can use the following shortcode.
Display a custom submit & redirect button
In situations where you wish to redirect users to a different page to display the results, you must use a custom submit button. You must enter the url where you wish to redirect users within the "submit" parameter as displayed below.
[pno-search-submit label="Search" submit="https://example.com/listings/"]
The fake query shortcode loads a tiny invisible query on the page and signals the facets to load on that page. You can add this shortcode anywhere into the content of your page.
If you're a developer and have instead created a custom WP_Query and you wish to use facets with your custom query, you can add the "pno_search" parameter with a boolean value of "true" to your WP_Query arguments list.
Example use case of the Fake Query shortcode
This is a practical common example when the fake query shortcode should be used along your facets. Imagine you wish to have an homepage with a seach form that redirects to another page and display the search results, just like our live demo. Because our homepage does not display any listings you must use the fake query shortcode in order for your facets to load properly.