Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Last active January 3, 2023 16:59
Show Gist options
  • Save mgibbs189/11aaddeaeebab5ce7f68 to your computer and use it in GitHub Desktop.
Save mgibbs189/11aaddeaeebab5ce7f68 to your computer and use it in GitHub Desktop.
FacetWP - available facet settings
/* updated 2019-02-22 */
{
"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"
}
]
}
@vreemt
Copy link

vreemt commented Jan 3, 2023

proximity with miles, I'm assuming the more sane world would want to use km for the unit

{
  "facets": [
    {
      "name": "location",
      "label": "Location",
      "type": "proximity",
      "source": "acf/field_id",
      "unit": "mi",
      "radius_ui": "dropdown",
      "radius_options": "10, 25, 50, 100, 250",
      "radius_min": "1",
      "radius_max": "50",
      "radius_default": "25",
    }
  ]
}

see also https://facetwp.com/help-center/facets/facet-types/proximity/ (this facet needs a google api key to work)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment