“Unexpected Token” Error / Map Not Displaying (Solution)
-
I thought I would share this bit of info so the plugin author can correct this issue that took me an hour or two to work out.
For some reason, on my site where I installed this plugin, the maps I created would NOT show up. The console would show “Unexpected Token ‘>'” or something similar and link to a line in the code that wasn’t even relevant. Upon investigation, it turns out WordPress was adding paragraph tags INSIDE the jQuery that is essential to this plugin to work. In my case, turning off wpautop did not correct this issue.
To correct, I went to the following file on my site: /wp-content/plugins/wp-google-map-plugin/modules/shortcode/views/put-wpgmp.php and found the jQuery script tag at the bottom. The fix for this is simple; you just have to make sure that the entire script tag is on one line so paragraph tags can’t be placed inside the code:
$map_output .= '<script>jQuery(document).ready(function($) {var map = $("#map'.$map_id.'").maps('.$map_data_obj.').data("wpgmp_maps");});</script>';
- The topic ‘“Unexpected Token” Error / Map Not Displaying (Solution)’ is closed to new replies.