Show results of FacetWP by Content Views Pro layout

FacetWP plugin helps you to show facets and results for your WordPress content. The facets are shown using its shortcode [facetwp facet="my_facet"], the results are shown using this shortcode [facetwp template="my_template"].
You can use Content Views Pro to display the results of FacetWP plugin in grid and another layout easily. Here are steps:

1/ Browse to Settings > FacetWP, click the “Templates” tab, select the template which you are using, then copy and backup the code in “Display Code” to somewhere.

2/ Replace “Display Code” content with this:

if ( shortcode_exists( 'pt_view' ) ) :
	$pids = array();
	while ( have_posts() ) :
		$pids[] = get_the_ID();
	echo $pids ? do_shortcode( '[pt_view id="VIEW_ID" post_id="' . implode( ',', $pids ) . '"]' ) : '';
else : ?>
	Paste the backed up content (in step 1) here
<?php endif; ?>

3/ replace VIEW_ID with ID of the View (which will be used to show FacetWP results).

Notice: The results and pagination depend on the FacetWP plugin, therefore Filter Settings, Pagination settings in View will not be applied.

Thank you,

Scroll to Top