→ Number Range

Overview

Allow users to filter content based on a numerical field value.

facet-type-number

Available Options

Name Description
Other data source Use this setting if you want to use a separate value for the Max
Compare type Basic: selected values must be entirely in range
Intersect: selected values must be at least partially in range

Notes

The value should be an unformatted number, without thousands-separators or currency signs. If needed, use the facetwp_index_row hook to clean the value for FacetWP’s indexer:

function index_raw_number( $params, $class ) {
    if ( 'YOUR_FACET_NAME' == $params['facet_name'] ) {
        $params['facet_value'] = preg_replace( "/[^0-9.]/", '', $params['facet_value'] );
    }
    return $params;
}
add_filter( 'facetwp_index_row', 'index_raw_number', 10, 2 );