Shortcodes Reference
The following features can be placed with a shortcode:
Display a facet
All facets you add can be placed with a shortcode:
[facetwp facet="the_facet_name"]
Or with PHP:
echo facetwp_display('facet','the_facet_name');
Display a template
All templates you add with the Listing Builder can be placed with a shortcode:
[facetwp template="the_template_name"]
Or with PHP:
echo facetwp_display('template','the_template_name');
Display user selections
User Selections dynamically show each choice the user makes with the available facets on the page:
User selections can be placed with a shortcode:
[facetwp selections="true"]
Or with PHP:
echo facetwp_display('selections');
Shortcode placement
Shortcodes can be added to the body field of your pages, or into Text widgets (Appearance > Widgets). If you’re using the WordPress 5.0 block editor, you can paste shortcodes into a Shortcode block:
Deprecated shortcodes
The following shortcodes still work, and will keep working for the foreseeable future, but we strongly recommend you use the new facet types they are replaced with.
Display a sort box
The old sort box can be placed with a shortcode:
[facetwp sort="true"]
Or with PHP:
echo facetwp_display('sort');
The options and logic of the dropdown can be controlled with the (deprecated) facetwp_sort_options hook, and the appearance with the (deprecated) facetwp_sort_html hook.
Display a pager
The old pager can be placed with a shortcode:
[facetwp pager="true"]
Or with PHP:
echo facetwp_display('pager');
The appearance of the pager can be controlled with the the (deprecated) facetwp_pager_html hook.
Display a per page box
The old per page box can be placed with a shortcode:
[facetwp per_page="true"]
Or with PHP:
echo facetwp_display('per_page');
The choices of the per page box can be customized with the (deprecated) facetwp_per_page_options hook.
Display result counts
The old result counts can be placed with a shortcode:
[facetwp counts="true"]
Or with PHP:
echo facetwp_display('counts');
The appearance of the result counts can be customized with the (deprecated) facetwp_result_count hook.