Skip Navigation

[Resolved] use latitude and longitude in another plugin

This support ticket is created 5 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 7 replies, has 2 voices.

Last updated by Luo Yang 5 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1302285

I have a nearby plug that show nearby places in google map.
The plugin recieve lat and long values from custom field from any custom post
How can i pass lat and long values from an toolset map adress field ?

#1302513

Hello,

You can use Types shortcode to output custom address field latitude and longitude values directly, for example:
latitude: [types field='my-address' format='FIELD_LATITUDE'][/types]
longitude: [types field='my-address' format='FIELD_LONGITUDE'][/types]

see our document:
https://toolset.com/documentation/customizing-sites-using-php/functions/#address
format:
Use the literals FIELD_ADDRESS, FIELD_LATITUDE and FIELD_LONGITUDE in the format to output the address

#1302601

thanks,
But how should i have a custom field populated with this values , as the nearby plugin need a custom field to base on it for displaying nearby places....

#1302603

Toolset Maps plugin stores latitude and longitude values in another custom database table: "wp_toolset_maps_address_cache",
They are not custom fields.

So there isn't such a built-in feature within Toolset Maps plugin, I suggest you try one of below options:
1) Contact with author of nearby plugin, check if is possible to use shortcodes to pass the latitude and longitude values.

2) Create two custom single line fields(latitude and longitude), use these two fields to store the latitude and longitude values.

#1302605

bsd

"2) Create two custom single line fields(latitude and longitude), use these two fields to store the latitude and longitude values."
I do i store them there?

#1302615
coordinates.JPG

You will need to set those two custom fields(latitude and longitude) manually, you can get the coordinates values from custom address field by clicking "Show/Hide coordinates" link, see screenshot: coordinates.JPG

#1302661

i am talking about hundreds of CPT properties .
It should be done dynamicily

#1302677

As I mentioned above, there isn't such kind of built-in feature within Toolset Maps plugin, if you need to it to be done dynamically, you will need to consider custom codes, for example:
After user set address value in custom address field, save the post, you can use WordPress action hook save_post to trigger a custom PHP function:
https://developer.wordpress.org/reference/hooks/save_post/

In this PHP function do these:
1) Get the latitude and longitude values from your address field:
https://toolset.com/documentation/customizing-sites-using-php/functions/

2) Save above values into those two custom single line fields:
https://codex.wordpress.org/Function_Reference/update_post_meta

For your reference.