Last active
August 24, 2020 17:48
-
-
Save djrmom/5795cee7271f1be98fceb2563fa91f03 to your computer and use it in GitHub Desktop.
facetwp copy range to dropdown
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 | |
/** create a range list facet with the ranges you need | |
** create a dropdown facet with any datasource, post type is good its just a placeholder | |
** change the code below to match your facet names | |
**/ | |
add_filter( 'facetwp_index_row', function( $params, $class ) { | |
if ( 'my_range_facet' == $params['facet_name'] ) { // change 'my_range_facet' to the name of your range list facet | |
$params['facet_name'] = 'dropdown_range'; // trick FacetWP into saving values into the other facet | |
} elseif ( 'dropdown_range' == $params['facet_name'] ) { // change 'dropdown_range' to the name of your dropdown facet in this and the above line | |
$params['facet_value'] = ''; // skip indexing | |
} | |
return $params; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment