Overview

FacetWP Hierarchy facetThe hierarchy facet type lets users navigate through a hierarchical taxonomy.

Available options

Name Description
Data source The taxonomy to pull values from.
Default label Set the label for the top-level option (default: “Any”). Note: this label is translatable with the facetwp_i18n hook.
Value modifiers Enter a list of values (one per line) to include or exclude from the facet’s choices. The values need to match the label of the value exactly, including spaces and capitalization. If they don’t work, see this page for more info.
Sort by Sort facet choices by:

  • Highest count – sorts by the total number of results with that value.
  • Display value – sorts alphabetically according to the label you see on the facet choices.
  • Raw value – sorts by the value that tracks the facet choices. For example in a dropdown, this is the option value rather than the option label. You can see the raw values in the url after making facet selections.
  • Term order – sorts by taxonomy term order. This option uses term_order which is only available when using a plugin that sets an explicit order for taxonomy terms. FacetWP supports:
Count The number of options to display. Be aware that if your source is a hierarchical taxonomy, the count includes the child terms/categories. If the count is too low, (some) child options will not show up.

What are value modifiers?

Value modifiers let you include or exclude certain choices from displaying. This setting requires a re-index to take effect. Below are some examples.

The values you enter in a facet’s “Value modifiers” field need to match the label of the value exactly, including spaces and capitalization. If they don’t work, see this page for more info.

Indexing of term hierarchies

FacetWP automatically indexes both explicit and implicit term hierarchies. If your taxonomy includes France > Paris and the user only chooses Paris, then France will get indexed too.

Hide counts

To hide the counts for all facets of type Hierarchy, Checkboxes, Radio, and Range List (in UI modes “None”, “Radio” or “Checkboxes”), add this CSS into your theme’s style.css:

.facetwp-counter {
    display: none;
}

If you need to be specific about which (type of) facet to hide the counts for, use any of the following styles:

/* Hide counts in all Hierarchy facets */
.facetwp-type-hierarchy .facetwp-counter {
    display: none;
}

/* Hide counts in a specific Hierarchy facet */
.facetwp-facet-yourfacetname .facetwp-counter {
    display: none;
}

See also