Tell us what you are trying to do?
I've installed the Toolset Maps plugin and now I want to create a maps marker in my loop with a collection of this data:
- a custom field called 'street' (from custom post type 'shops')
- a custom field called 'housenumber' (from custom post type 'shops')
- the wp-title field (from the related custom post type called 'cities')
- a custom field called 'zipcode' linked to the custom post type called 'cities'.
This is the relationship between my 2 custop post types:
Cities [0 .. 1] << Shops [*]
How can I combine those 4 fields so I can output it in the 'Marker' shortcode?
Thanks for helping!
Hi Roularta,
Thank you for waiting.
The "wpv-map-marker" shortcode, supports an "address" attribute, which can be used to pass on the location's information.
( ref: https://toolset.com/documentation/user-guides/maps-shortcodes/#wpv-map-marker )
Google's Location API seems to understand the address information in this order/format:
House Number, Street Direction, Street Name, Street Suffix, City, State, Zip, Country
Based on that, you can use the available data in the marker shortcode like this:
( assuming it is being used in the "Shops" post loop in a View )
[wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-id]' address='[types field="shop-housenumber"][/types], [types field="shop-street"][/types], [wpv-post-title item="@city-shop.parent"], [types field="city-zipcode" item="@city-shop.parent"][/types]'][/wpv-map-marker]
Feel free to replace the field slugs and map_id with the actual data on your website.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
That code does the trick! I'm glad I didn't need to change my database by adding an extra custom field to make it work. Thanks! 🙂