Shortcodes

FacetWP features (facets, templates, pagination, sorting, etc) are added to your site using shortcodes. Each shortcode is covered below.

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:

Available features

Shortcode PHP
[‍facetwp facet="the_name"]
echo facetwp_display( 'facet', 'the_name' )
[facetwp template="the_name"]
echo facetwp_display( 'template', 'the_name' )
[facetwp pager="true"]
echo facetwp_display( 'pager' )
[facetwp per_page="true"]
echo facetwp_display( 'per_page' )
[facetwp selections="true"]
echo facetwp_display( 'selections' )
[facetwp counts="true"]
echo facetwp_display( 'counts' )
[facetwp sort="true"]
echo facetwp_display( 'sort' )
Note: we’ve recently added a Pager facet type which can replace the Pager, Per Page, and Counts shortcodes