Skip Navigation

[Resolved] Maps keep defaulting to Africa when post first created

This thread is resolved. Here is a description of the problem and solution.

Problem:

Display the map + marker shortcodes with PHP codes.

Solution:

You can try with a content template:

https://toolset.com/forums/topic/maps-keep-defaulting-to-africa-when-post-first-created/#post-2134455

Relevant Documentation:

https://toolset.com/documentation/programmer-reference/views-api/#render_view_template

This support ticket is created 3 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 2 replies, has 2 voices.

Last updated by JoshuaD7497 3 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#2133915

I'm using a custom field (Map Location) for a custom post type. This works fine.

Every time a new cottage type post is added, even though the map is set correctly, on the front end it always defaults to a map of the horn of Africa. The client has to contact me every time to correct it.

I usually just log in, update the cottage post without actually changing anything, and this magically works. But my client can't do this same corrective action on her Mac. It's irritating because she has to contact me to do this every time a new cottage is added, even when I'm on holiday or away.

Last week, even this trick for correcting it didn't work for a new cottage and I had to wiggle the map marker and update the post for it to work. But normally just updating the post is enough. So, I'm concerned the issue is worsening.

The custom post for cottages uses a single page template written in PHP. To display the map, these shortcodes are included at the bottom of the template:

<?php echo do_shortcode ('[wpv-map-render map_id="map-1" map_height="400px" ]'); ?>
<?php echo do_shortcode ('[wpv-map-marker map_id="map-1" marker_id="marker-1" marker_field="wpcf-google-map-location"][/wpv-map-marker]'); ?>

Where could the problem lie? Any advice appreciated. No desperate urgency as this only crops up when a new cottage is added.

Thanks,
Josh.

#2134455

Hello,

I assume you are going to display the map + marker shortcodes with PHP codes.

I suggest you try these:
1) Create a content template, display the map + marker shortcodes
2) Output about content template shortcode with Views API function render_view_template():
https://toolset.com/documentation/programmer-reference/views-api/#render_view_template

#2135447

Thanks Luo.

I will try this approach and see if this helps.

Many thanks.