<?php
// Allow FacetWP to detect Salient's Visual Composer Post Loop Builder
// Needs the 'facetwp-template' class set on the Post Loop Builder element: https://d.pr/i/x4j75G
// Disable the element's own (Load more) pagination: https://d.pr/i/4ZumQ0
// Use a Pager facet instead (numbered or load more type).
add_filter( 'nectar_post_grid_query', function( $query_args ) {
if ( $query_args['post_type'] == 'resource' ) {
// Detect Post Loop Builder Grid query
$query_args['facetwp'] = true;
// Fix FacetWP pagination. Without this, Pager or Load More Pager facet will not work
if ( array_key_exists('offset', $query_args ) ) {
unset( $query_args['offset'] );
}
}
return $query_args;
}, 10 );