Skip to content

Instantly share code, notes, and snippets.

@adaptifyDesigns
Created April 20, 2016 16:41
Show Gist options
  • Save adaptifyDesigns/f68eee177a74e660b084540b9da3675e to your computer and use it in GitHub Desktop.
Save adaptifyDesigns/f68eee177a74e660b084540b9da3675e to your computer and use it in GitHub Desktop.
/**
* Ensure that FacetWP detects custom post-type query loops:
* NOTE: the query vars must have a custom 'facetwp' parameter, like this:
$args = array(
'post_type' => 'event',
'posts_per_page' => 10,
'facetwp' => true, // we added this
);
$query = new WP_Query( $args );
*/
function wuwo_facetwp_is_main_query( $is_main_query, $query )
{
if ( isset( $query->query_vars['facetwp'] ) ) {
$is_main_query = true;
}
return $is_main_query;
}
if( function_exists('facetwp_display') )
{
add_filter( 'facetwp_is_main_query', 'wuwo_facetwp_is_main_query', 10, 2 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment