Skip to content

Instantly share code, notes, and snippets.

@djrmom
Created January 9, 2018 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djrmom/f4d9542436a56f3122729721712bf0bb to your computer and use it in GitHub Desktop.
Save djrmom/f4d9542436a56f3122729721712bf0bb to your computer and use it in GitHub Desktop.
facetwp facetwp_query_args shortcode template filter
<?php
add_filter( 'facetwp_query_args', function( $query_args, $class ) {
if ( 'gluten_free' == $class->ajax_params['template'] && 'gluten-free-everywhere' == $class->http_params['uri'] ) {
$query_args['tax_query'] = array(
array(
'taxonomy' => 'category', // change 'category' to different taxonomy if needed
'field' => 'slug',
'terms' => array( 'entertainment', 'travel', 'breakfast-box', 'lunchbox', 'gluten-free-guides' ) // array of term slugs
)
);
}
return $query_args;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment