• Resolved agthalim

    (@agthalim)


    Hello Camille,
    I’m trying to set up a search.php template, shoxing the results of a search.
    I’m adapting that from the underscores theme.
    The above example shows the results of a search for “Assouan” (4 articles). My dream would be presenting a map with only the markers corresponding to these articles.

    I tried to insert this shortcode on top of the template, but it shows the markers corresponding to all articles of the blog. The inserted line was :

    <?php echo do_shortcode( ‘ [travelers-map minzoom=3 width=100% height=100vh post_types=post,page tileurl=”https://{s}.tile.jawg.io/jawg-dark/{z}/{x}/{y}{r}.png?access-token=EDiK4LQEjFpT2p7S06fbibeGK6KTsbSPR7hYkaMQYj9VfeswuOoxJOFXlL9NkI6E” subdomains=”abc” attribution=\’\’ title=”Tiles Courtesy of Jawg Maps” target=”_blank” ] ‘ );?>

    Probably it should be inserted inside the loop, but all it did was repeating the whole thing for every article. I feel that I should somehow tell the shortcode to apply the current query, but I don’t kn ow how to do that.
    Can you advise a direction for me ?

    Thank you in advance !

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

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

    (@socrapop)

    Dear @agthalim ,

    There is a shortcode parameter made just for that :
    current_query_markers=true

    It is what I use on my search result page : https://camilles-travels.com/?s=lacs

    On a sidenote, if you use the same tileurl and provider everywhere on your website, I advise you to set it in the Travelers Map Global Settings page. That way you won’t have to add it in the shortcode everytime. (the shortcode parameters tileurl, subdomains and attribution where made to override the global settings of Travelers Map 🙂

    Thread Starter agthalim

    (@agthalim)

    Thank you for answering.
    However I tried straight to apply your answer, i.e. the page with search.php as model has this shortcode :

    [travelers-map current_query_markers=true minzoom=3 width=100% height=100vh post_types=post,page tileurl=”https://{s}.tile.jawg.io/jawg-dark/{z}/{x}/{y}{r}.png?access-token=…” subdomains=”abc” attribution=’© <b>Jawg</b>Maps © OpenStreetMap contributors’]

    But the page https://ecopoetique.huma-num.fr/?s=Assouan shows all markers, although it shows only a fex results.

    What did I miss ?…

    Thread Starter agthalim

    (@agthalim)

    The stuff is resolved !
    Thank you. Indeed the parameter

    current_query_markers=true

    did the job. It worked when I inserted it inside the search results template search.php :
    <?php echo do_shortcode( ‘ [travelers-map minzoom=3 current_query_markers=true width=100% height=100vh post_types=post,page tileurl=”https://{s}.tile.jawg.io/jawg-dark/{z}/{x}/{y}{r}.png?access-token=…” subdomains=”abc” attribution=\’\’ title=”Tiles Courtesy of Jawg Maps” target=”_blank” ] ‘ );?>

    Thank you again !

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘mapping just the search results’ is closed to new replies.