Overview

Register new facet types. Please also read about how to create custom facet types.

Parameters

  • $facet_types | array | An array of facet type objects

How to use custom PHP code?

PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

$facet_types = [ 'checkboxes' => new FacetWP_Facet_Checkboxes(), 'date_range' => new FacetWP_Facet_Date_Range(), 'dropdown' => new FacetWP_Facet_Dropdown(), 'hierarchy' => new FacetWP_Facet_Hierarchy(), //... ];

Usage

How to use custom PHP code?

PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_filter( 'facetwp_facet_types', function( $facet_types ) { $facet_types['map'] = new FacetWP_Facet_Map(); return $facet_types; });

More examples

See also