Last active
November 20, 2015 18:44
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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