Forums

Geotag
Geotagging categorys and tags (8 posts)

  1. herrpedro
    Member
    Posted 1 year ago #

    does anyone has any code to add a map to "tags pages" or "category page" ?

    i'd like to display a map with all the places with info of the posts with that tag or category

    any ideas?

    thank you all

  2. Boris
    Member
    Posted 1 year ago #

    Let's assume that you want to display a map on your categories archive page which a marker of all the posts in this category:

    1. Open the file category.php of your current template.
    2. Look for a proper location where the map should be displayed and insert the follwing php code:

    <?php
     if (is_category()) {
      $category = get_query_var('cat');
      if (class_exists('Geotag')) {
       Geotag::the_geotag('print_map', array('marker_query' => 'cat='.$category));
       }
     }
    ?>

    This examples uses the new the_geotag function of Geotag v2.0 which allows you to create maps in your templates. Just tell the function the current category_id and that's it.

  3. herrpedro
    Member
    Posted 1 year ago #

    was hard to find the category listing since i got a "special" theme but it is in right place cause I put an Echo and it only appears in my category page :)

    the map does not show but it must be my "usual" problem...

    for tags.... is it tag?
    the rest I saw it in wordpress codex :)

    '<?php
    if (is_tag()) {
    $posttag = get_query_var('tag');
    if (class_exists('Geotag')) {
    Geotag::the_geotag('print_map', array('marker_query' => 'tag='.$posttag ));
    }
    }
    ?>
    '

  4. Boris
    Member
    Posted 1 year ago #

    Yes, that should work. get_query_var('tag') should return the tag-slug and tag=... should be the right marker_query...

  5. herrpedro
    Member
    Posted 1 year ago #

    went from disable plugin in and disable plugin and.. got a map :)

    maps show all :) (with markermanager and all :))) )

    category shows category maps (but only last 6.. no all :( )

    tag does not show any map...
    added a "echo" in the if class_exists to check if it run geotag:: and the echo displayed my message

  6. le soleil
    Member
    Posted 1 year ago #

    Hi there.
    First of all, thanks for the great plugin.

    But i'd like to ask about one more functionality.

    Is there a possibility to edit the way, how the pop-out boxes on the map with multiple markers (e.g. on the category page) are displayed?
    I mean that pop-out box that is shown when you click on the marker — it displays the title and the date of post. Can I change that to, e.g., the title and the post thumbnail?

    I assume that i should edit the geotag.php file, but i don't know exactly where and if it's good thing to do without your permission.

  7. Boris
    Member
    Posted 1 year ago #

    @le soleil:
    Of course, you can modify the plugin as you like. Have a look at (approx.) line 2048 and 2065 where $markers[$i]['content'] is defined. The content of this variable will be used as the content of the infowindow for posts (2048) and for photos (2065).

  8. herrpedro
    Member
    Posted 10 months ago #

    hi all

    @bobs :)
    hi bobs ,

    about my issue

    "category shows category maps (but only last 6.. no all :( )

    tag does not show any map...
    added a "echo" in the if class_exists to check if it run geotag:: and the echo displayed my message"

    if i may as 1 more thing...
    i can i change it to "if it is a post center on that marker although i have a query?"

    thank you for your patience

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags