Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Last active November 20, 2015 18:44
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 mgibbs189/e7bdaa28363408d8f0e0 to your computer and use it in GitHub Desktop.
Save mgibbs189/e7bdaa28363408d8f0e0 to your computer and use it in GitHub Desktop.
Use facetwp_template_html to prevent loading the template when no facets are selected
<?php
function fwp_override_template( $return, $class ) {
foreach ( $class->ajax_params['facets'] as $facet ) {
if ( ! empty( $facet['selected_values'] ) ) {
return false; // don't override
}
}
return ''; // override
}
add_filter( 'facetwp_template_html', 'fwp_override_template', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment