Created
September 21, 2022 17:49
-
-
Save f3bruary/1bd04dcfcab840749c9ffe3478a644ec to your computer and use it in GitHub Desktop.
FacetWP: Register facets programmatically (via code)
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 | |
/* updated 2022-09-21 */ | |
$facets = [ | |
[ | |
'name' => 'test_checkboxes', | |
'label' => 'Test checkboxes', | |
'type' => 'checkboxes', | |
'source' => 'post_type', | |
'parent_term' => '', | |
'hierarchical' => 'no', | |
'show_expanded' => 'no', | |
'ghosts' => 'no', | |
'preserve_ghosts' => 'no', | |
'operator' => 'and', | |
'orderby' => 'count', | |
'count' => '10', | |
'soft_limit' => '5' | |
], | |
[ | |
'name' => 'test_dropdown', | |
'label' => 'Test dropdown', | |
'type' => 'dropdown', | |
'source' => 'post_type', | |
'parent_term' => '', | |
'hierarchical' => 'no', | |
'orderby' => 'count', | |
'count' => '20', | |
'label_any' => 'Any' | |
], | |
[ | |
'name' => 'test_fselect', | |
'label' => 'Test fSelect', | |
'type' => 'fselect', | |
'source' => 'post_type', | |
'parent_term' => '', | |
'hierarchical' => 'no', | |
'ghosts' => 'no', | |
'preserve_ghosts' => 'no', | |
'operator' => 'and', | |
'orderby' => 'count', | |
'count' => '10', | |
'label_any' => 'Any', | |
'multiple' => 'no' | |
], | |
[ | |
'name' => 'test_hierarchy', | |
'label' => 'Test hierarchy', | |
'type' => 'checkboxes', | |
'source' => 'post_type', | |
'parent_term' => '', | |
'hierarchical' => 'no', | |
'show_expanded' => 'no', | |
'ghosts' => 'no', | |
'preserve_ghosts' => 'no', | |
'operator' => 'and', | |
'orderby' => 'count', | |
'count' => '10', | |
'soft_limit' => '5' | |
], | |
[ | |
'name' => 'test_search', | |
'label' => 'Test search', | |
'type' => 'search', | |
'source' => 'post_type', | |
'search_engine' => '', | |
'placeholder' => '', | |
'auto_refresh' => 'no' | |
], | |
[ | |
'name' => 'test_autocomplete', | |
'label' => 'Test autocomplete', | |
'type' => 'autocomplete', | |
'source' => 'post_type', | |
'placeholder' => '' | |
], | |
[ | |
'name' => 'test_slider', | |
'label' => 'Test slider', | |
'type' => 'slider', | |
'source' => 'post_type', | |
'compare_type' => '', | |
'prefix' => '', | |
'suffix' => '', | |
'format' => '0,0', | |
'step' => '1', | |
'source_other' => '' | |
], | |
[ | |
'name' => 'test_date_range', | |
'label' => 'Test date range', | |
'type' => 'date_range', | |
'source' => 'post_type', | |
'compare_type' => '', | |
'fields' => 'both', | |
'format' => '', | |
'source_other' => '' | |
], | |
[ | |
'name' => 'test_number_range', | |
'label' => 'Test number range', | |
'type' => 'number_range', | |
'source' => 'post_type', | |
'fields' => 'both', | |
'compare_type' => '', | |
'source_other' => '' | |
], | |
[ | |
'name' => 'test_proximity', | |
'label' => 'Test proximity', | |
'type' => 'proximity', | |
'source' => 'post_type', | |
'unit' => 'mi', | |
'radius_ui' => 'dropdown', | |
'radius_options' => '10, 25, 50, 100, 250', | |
'radius_min' => '1', | |
'radius_max' => '50', | |
'radius_default' => '25', | |
'source_other' => '' | |
], | |
[ | |
'name' => 'test_radio', | |
'label' => 'Test radio', | |
'type' => 'radio', | |
'source' => 'post_type', | |
'parent_term' => '', | |
'ghosts' => 'no', | |
'preserve_ghosts' => 'no', | |
'operator' => 'or', | |
'orderby' => 'count', | |
'count' => '20' | |
], | |
[ | |
'name' => 'test_star_rating', | |
'label' => 'Test star rating', | |
'type' => 'rating', | |
'source' => 'post_type' | |
], | |
[ | |
"label" => "Load More", | |
"name" => "loadmore", | |
"type" => "pager", | |
"pager_type" => "load_more", | |
"load_more_text" => "Load more...", | |
"loading_text" => "Fetching...", | |
], | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment