Skip to content

Instantly share code, notes, and snippets.

@whoaloic
Created August 30, 2016 06:20
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 whoaloic/f5c1f185212cbd21de8d67145feda5f6 to your computer and use it in GitHub Desktop.
Save whoaloic/f5c1f185212cbd21de8d67145feda5f6 to your computer and use it in GitHub Desktop.
Facet wp index level category
function index_top_level_terms( $params, $class ) {
if ( 'univers' == $params['facet_name'] ) {
if ( 0 < $params['depth'] ) {
return false; // don't index child terms
}
}
if ( 'familles' == $params['facet_name'] ) {
if (( 0 == $params['depth'] ) || ( 2 == $params['depth'] )) {
return false; // index level 2 terms
}
}
return $params;
}
add_filter( 'facetwp_index_row', 'index_top_level_terms', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment