facetwp custom table
Support › MB FacetWP Integration › facetwp custom tableResolved
- This topic has 4 replies, 2 voices, and was last updated 5 years, 2 months ago by
EricHedvat.
-
AuthorPosts
-
August 19, 2020 at 3:47 AM #21342
EricHedvat
ParticipantIve seen a previous thread on connecting facetwp to custom table fields from 2 yrs ago, but no conclusive answer.
Inside facetwp plugin folder there is a file class-helper.php, with this line:
// Get custom fields $meta_keys = $wpdb->get_col( "SELECT DISTINCT meta_key FROM {$wpdb->postmeta} ORDER BY meta_key" );Since I am storing my meta fields/values in a custom table, will it be enough to just change this line? And what should it be changed to?
August 19, 2020 at 2:44 PM #21346Long Nguyen
ModeratorHi Eric,
The extension Meta Box - FacetWP Integrator also supports to index the post which has the field's value save in the custom table. See my screen record https://www.loom.com/share/bfee1ed88ef04a33bf79c16147898163.
If you want to customize more, please follow the developer documentation of Facet https://facetwp.com/documentation/developers/.
August 19, 2020 at 5:24 PM #21350EricHedvat
ParticipantThanks it works, makes sense.
Related to this however, I have tried to create a 'Proximity' Facet which connects to the google maps metabox field - the LAT/LONG of the address. It doesnt seem to work, nor does it register the location coordinates in the facetwp index table in db.
here is my map field
[ 'id' => $prefix . 'map_lat_long', 'type' => 'map', 'name' => esc_html__( 'Map', 'text-domain' ), 'address_field' => 'building_address', 'api_key' => '...', 'region' => '.us', 'std' => '40.7831, -73.9712,14', ],Thanks.
August 19, 2020 at 9:52 PM #21353Long Nguyen
ModeratorHi,
FacetWP can’t filter by maps. You should make it filter by other fields (cities, wards, etc.), and the map will be displayed accordingly.
Refer to this topic https://support.metabox.io/topic/render-openstreetmap-for-archive-pages-elementor-or-any/.
August 19, 2020 at 10:38 PM #21356EricHedvat
ParticipantThe documentation states it can filter by lat/long: https://facetwp.com/documentation/facets/facet-types/proximity/
It also says "The Data Source should be a custom field containing a comma-separated latitude, longitude."
My map field in the custom table is stored exactly like this (provided an address is selected via the building_address field. -
AuthorPosts
- You must be logged in to reply to this topic.