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

[pno-search-facet facet="3"]

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.

[pno-search-pagination]

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.

[pno-search-per-page]

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.

[pno-search-sort]

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.

[pno-search-counts]

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/"]

Display limitations

Facets will only display on pages that contain listings queries. By default, queries that are supported are the ones in the following scenarios:
Page that uses the "listings page" shortcode.
Page that uses the recent listings shortcode.
All taxonomy archives pages.
If you wish to display facets on a page that does not have listings, you have the option of using a fake query shortcode.
[pno-search-fakequery]

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.