Skip to content

CodeCabin/wp-google-maps-range-slider-filter-widget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Custom Filtering Widget Example

This repo shows how to use the hooks provided by WP Google Maps to add your own filtering widgets.

Please note the distinction between a "filter" (logic) and a "filtering widget" (UI).

Define your widget

  1. Define a class extending \WPGMZA\CustomFieldFilterWidget see here
  2. Add a filter on wpgmza_get_custom_field_filter_widget, returning an instance of your widget when the input $filter requests it by filter type.
  3. Add a filter on wpgmza_custom_fields_widget_type_options, returning an <option> element. This will allow the user to select your widget from the widget type dropdown.

Define the filtering logic

  1. Define a class extending \WPGMZA\CustomFieldFilter see here
  2. Override the getFilteringSQL method in this class. It receives the $value passed from the user, and should return a statement prepared by $wpdb->prepare.
  3. Add a filter on wpgmza_get_custom_field_filter, returning an instance of this class when the input $filter requests it by filter type.

About

An example of a custom filtering widget for custom fields

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published