Created
October 14, 2015 09:18
-
-
Save mgibbs189/809d6b593049d80fb0ff to your computer and use it in GitHub Desktop.
FacetWP - index parent terms and child terms in separate facets
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_index_categories( $params, $class ) { | |
if ( 'product_cat' == $params['facet_name'] && 0 < (int) $params['depth'] ) { | |
return false; // skip this term | |
} | |
elseif ( 'product_sub_cat' == $params['facet_name'] && 0 == (int) $params['depth'] ) { | |
return false; // skip this term | |
} | |
return $params; | |
} | |
add_filter( 'facetwp_index_row', 'fwp_index_categories', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment