• Resolved dtbaker

    (@dtbaker)


    Hey this plugin is amazing, and works great with a plain Gutenberg blog post or page.

    However when trying to insert the shortcode into an Elementor page builder it seems to spit out duplicate cttm variables causing the map to fail loading.

    There is only a single map div in the page source code, just a double up in the javascript area like this:

    
    <script type='text/javascript' id='travelersmap_init-js-extra'>
    /* <![CDATA[ */
    var cttm_options_params = { etc...
    var cttm_shortcode_60b8bc744acb8 = { etc..
    var cttm_options_params = { etc...
    var cttm_shortcode_60b8bc744acb8 = { etc..
    /* ]]> */
    </script>
    

    I think if you can prevent it loading double ups of this (i.e. don’t add it if already added) then it should fix up the issue.

    Is this project on github? I could take a look if you’re open to contributors.

    Cheers,
    Dave

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter dtbaker

    (@dtbaker)

    Hey I just forked the repo and pulled down a copy to my local dev, it works perfectly fine locally in Elementor, but not on the live website. There must be something I’ve got enabled on the live site that is causing the map to break.

    I’ll keep poking around.

    Plugin Author Camille V

    (@socrapop)

    Dear Dave,
    Thank you for this, it’s strange I never got this problem, I already had multiple shortcodes caused by elementor responsive hiding.
    In the next days, I will also change something to load the map only if the container is found. Right now it’s emitting an error if a container is not found. (some plug-ins generate multiple Travelers map shortcodes, I don’t know why)
    Yes of course I’m open to contributions, here is the github link https://github.com/Socrapop/travelers-map
    You can make a PR and I will add my changes to it!
    Have a nice day ??
    Camille

    Thread Starter dtbaker

    (@dtbaker)

    Hey I’ve fixed it for our particular case and it works great now ??

    Here’s the diff: https://github.com/Socrapop/travelers-map/pull/18

    I don’t mind if you close my PR, I’m happy to run my own modified code which works here. I removed a bunch of stuff that didn’t seem necessary like the global cttm_map[mapindex] stuff but you might want to keep that in for some compatibility reasons.

    Anyway feel free to check it out and pick bits out if you want to copy this approach.

    Cheers,
    Dave

    Plugin Author Camille V

    (@socrapop)

    Dear Dave,
    Thank you a lot for this I will have a look and keep what I can ??
    I’m currently reworking / refactoring the entire Plugin for V2 so I might take some time, but will definitely look into it.

    If I remember well, cttm-map[index] was introduced to let developers interact with the maps on the page with Javascript, like adding a leaflet plugin or using leaflet methods.
    Thats why it’s not used ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Incompatibility with page builders (e.g. Elementor)’ is closed to new replies.