Skip Navigation

[Resolved] Map markers not displaying on map

This support ticket is created 4 years, 8 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/Karachi (GMT+05:00)

This topic contains 9 replies, has 3 voices.

Last updated by Sammut 4 years, 8 months ago.

Assisted by: Waqar.

Author
Posts
#1317049

I have two API keys and looked over another thread and I am having an issue getting map markers to display. I have the code as follows:

[wpv-layout-start]
	[wpv-items-found]
	[wpv-map-render map_id="map-1" spiderfy="on"]Map is loading[/wpv-map-render]
	<!-- wpv-loop-start -->
		<wpv-loop>
          [wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-id]' marker_field='wpcf-location-address' marker_title='[wpv-post-title]'] Content [/wpv-map-marker]
          [wpv-post-title] - [types field='location-address'][/types]<br />
		</wpv-loop>
	<!-- wpv-loop-end -->

	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

I am pretty sure I am doign somethign wrong but not spotting it. I appreciate your help.

#1317135

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

What *do* you see?

The code above looks correct for showing a map with markers.

Do you see a map at all? What does it display (screenshot?).

Is the View returning posts (i.e. you see a list of post titles dash addresses)?

If you go to Toolset > Settings > Maps and you use the Check API button does it work correctly? Does the second API key have no referrer restrictions?

#1317157

Thank you!

Here is a link hidden link (pw: 4eyes)

And yes the API says it all good.

Thank you!

#1317169

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Although the button to check the Maps API suggests it is working correctly, it looks to me like it is not (because of the map off the coast of Africa).

Before going any further I would edit your second API key and ensure that it is set up for the Maps and Places API services and that it is unrestricted, i.e. that there are no referrer restrictions.

#1318483
Screenshot 2019-08-18_08-53-53-132.png

Thank you. Upon reviewing the Google Maps API setting and verifying with Google, all is in order. Albeit Google is not a fan of having it set to unrestricted. The issue still persists. If your experience can end any other insight it is appreciated! Thank you!

I also attached a screen of some of the cached data in Toolset.

#1319103

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Sammut,

Thank you for sharing the update and sorry to learn that the issue still persists.

Since Nigel in on a day off today, I'll be assisting you with this ticket.

During testing on my own website, I couldn't reproduce this issue, which suggests that there is something specific to your website.

Can you please share temporary admin login details, so that I can see how this view and the map is setup?

Note: Your next reply will be private and though no changes will be made on your website, please make a complete backup copy, before sharing the access details.

regards,
Waqar

#1320149

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Michael,

Thank you for sharing the admin access.

I've performed some tests on my website with similar address fields and a map in a view, but couldn't reproduce this issue. This suggests that this is something specific to your website.

To troubleshoot this further, I'll suggest the following steps:

1. Please make sure all plugins on the website are updated to the latest versions.

2. Temporarily deactivate all extra plugins (other than Toolset) and also test this with a default theme like Twenty Nineteen.

If the issue is fixed, you can start activating the theme and the plugins, one-by-one, to narrow this down to a possible conflict.

3. In case the issue still persists, I'll need a clone/snapshot of your website so that I can troubleshoot this on my own server.
( ref: https://toolset.com/faq/provide-supporters-copy-site/ )

Please let me know how it goes and I've set your next reply as private.

regards,
Waqar

#1324823

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Michael,

Thank you for sharing the duplicator package.

I've successfully deployed it on my own server and currently performing some troubleshooting.

Will update you as soon as it completes.

Thank you for your patience.

regards,
Waqar

#1325769

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Michael,

Thank you for waiting.

During the investigation, I discovered that the issue with the map markers stems from the custom function in your child theme's "functions.php" file:


// Rewrite the excerpt settings
remove_shortcode('wpv-post-excerpt');
remove_filter( 'get_the_excerpt', 'wp_trim_excerpt'  );

function custom_excerpt($text = '') {
    $raw_excerpt = $text;
    if ( '' == $text ) {
        $text = get_the_content('');
        // $text = strip_shortcodes( $text );
        $text = do_shortcode( $text );
        $text = apply_filters('the_content', $text);
        $text = str_replace(']]>', ']]>', $text);
        $text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
        //$text = strip_tags($text, '<p><a><img>');
        $excerpt_length = apply_filters('excerpt_length', 55);
        $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
        $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
    }
    return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
}
add_filter( 'get_the_excerpt', 'custom_excerpt'  );
add_shortcode('wpv-post-excerpt', 'get_the_excerpt');

The issue is fixed if:

1. The above custom code is removed from the theme.

OR

2. Yoast SEO plugin is disabled.

OR

3. In map marker's shortcode, map's ID is updated to have "-2"

For example, if your map's shortcode is:


[wpv-map-render map_id="map-1"][/wpv-map-render]

And the map marker shortcode is:


[wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-id]' marker_field='wpcf-location-address'][/wpv-map-marker]

The updated map marker shortcode will become:


[wpv-map-marker map_id='map-1-2' marker_id='marker-[wpv-post-id]' marker_field='wpcf-location-address'][/wpv-map-marker]

Note: Since other plugins like Yoast SEO plugin can use default excerpt filter, it is a good idea to register new custom filter, instead of redefining the original one.

I hope this helps.

regards,
Waqar

#1325951

THANK YOU!!!!! Amazing help!!!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.