• mirefoot

    (@mirefoot)


    Hi I am getting this error in the console on this page https://find-a-mooring.com/?s=plymouth

    Uncaught SyntaxError: Invalid or unexpected token and there is no marker showing on the page

    This is the code I am using which also uses WP-Types plugin

    
    <div>
    [fusion_builder_column type="1_2"]
    [wpv-conditional if="( $(wpcf-marina-latitude) ne '' ) AND ( $(wpcf-marina-longitude) ne '' )"]
    [leaflet-map lat=[types field='marina-latitude' output='raw'][/types] lng=[types field='marina-longitude' output='raw'][/types] zoom=16][leaflet-marker]
    [/wpv-conditional]
    [wpv-conditional if="( $(wpcf-marina-latitude) eq '' ) OR ( $(wpcf-marina-longitude) eq '' )"]
    [leaflet-map lat=[types field='office-lattitude' format='FIELD_VALUE'][/types] lng=[types field='office-longitude' format='FIELD_VALUE'][/types] zoom=16][leaflet-marker]
    [/wpv-conditional]
    [/fusion_builder_column]
    </div>
    

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author bozdoz

    (@bozdoz)

    Surprising. Looks like it’s likely a problem with fusion_builder, somehow. Check under the settings page for the shortcode helper page. Let me know if those maps work. If they do, then it’s likely an issue with one of those other plugins. It looks like it’s formatting *some* of the javascript; but not all.

    Thread Starter mirefoot

    (@mirefoot)

    Ok, so I’ve dropped in this code

    
    [leaflet-map zoom=10 lat=43.65 lng=-79.385]
    
    [leaflet-marker]
    
    [leaflet-marker lat=43.68 lng=-79.275]
    
    [leaflet-marker lat=43.67 lng=-79.4]
    

    Outside the loop at the top of the page then dropped it in inside the loop under every post title and the markers work outside the loop but not inside the loop?

    Plugin Author bozdoz

    (@bozdoz)

    My guess is that either the fusion_builder_column or wpv-conditional shortcodes are formatting the inner-shortcodes; but, somehow, the leaflet-map shortcode is working fine.

    In the DOM inspector you can see malformed JavaScript for the marker tag. For example:

    marker = L.marker(\[0,0\], marker_options)

    Those HTML entities are probably being created by a wrapping function (or shortcode) that is conditionally replacing special characters. I say conditionally, because leaflet-map shortcode appears to be fine, and because **most** of the marker script looks fine. For example:

    var _options = {},
        iconArrays = ['iconSize', 'iconAnchor', 
        'shadowSize', 'shadowAnchor'];
    • This reply was modified 7 years ago by bozdoz.
    • This reply was modified 7 years ago by bozdoz.
    Plugin Author bozdoz

    (@bozdoz)

    I can’t seem to show the HTML entities without WordPress formatting it properly in the comment. Reads like this without the spaces:

    & # 0 9 1 ; 0 , 0 & # 0 9 3 ;

    But should be:

    [0, 0]

    Thread Starter mirefoot

    (@mirefoot)

    So I changed theme, no difference, dropped plugins, no difference except when I disable wp-types and its various plugins. I need types for the layouts and I think there must be an interaction between wp-types and your plugin but I’m not qualified to find out what it is.

    Plugin Author bozdoz

    (@bozdoz)

    wp-types is a plugin? Send me the link maybe and I can test.

    Thread Starter mirefoot

    (@mirefoot)

    Yes https://wp-types.com/
    I have managed to get it to work, but without using your plugin on this page. I am using it for the draggable icon on a different page. Thanks for your help.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Uncaught SyntaxError: Invalid or unexpected token’ is closed to new replies.