• Resolved tracteur

    (@tracteur)


    Hi Camille !

    Many thanks for your awesome plugin, this is exactly what I was looking for ??
    I just had a request :

    I’d like to display a map under each post.
    Having to add a shortcode on each post seems quite boring and I’m pretty shure I’ll forget it more than once while on travel.

    To counter that, I added on my template this line :
    echo do_shortcode(‘[travelers-map init_maxzoom=9 this_post=true centered_on_this=true]’);

    It does works wonderfully; I don’t have to enter the shortcode on my posts.

    My issue is :
    I might, one day, create a post or two without any marker.
    With my evolution, a grey map is displaying “no marker found” of something like that.

    Would thi be possible to add a param to the shortcode not to display any map is no marker was found ? If not, is there any param I could use in an “IF” loop before the “ECHO” line I’m doing to prevent shortcode insertion if no marker found ?

    Many thanks ! ??

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Camille V

    (@socrapop)

    Dear Baptiste,

    There is no parameter for that, but that’s a nice idea for the futur! I will add it in my todo list.
    In the meantime, you can use a simple CSS rule to hide the container when leaflet is not loaded. In the last update, I added a condition to init leaflet only if markers are found on the page.
    Leaflet adds classes to the container when it’s loaded, so the CSS would be:

    .travelersmap-container:not(.leaflet-container){
        display: none;
    }

    Voilà!
    Have a nice day ??
    Camille

    Thread Starter tracteur

    (@tracteur)

    Well, thank you so much for this css snippet !
    I’m glad you considered my request ??

    Again, thanks a lot for your plugin, it’ perfect for my travel blog ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Evolution : shortcode showing nothing when no marker found’ is closed to new replies.