Reset Automatic Maps

Home Forums MapPress Support Reset Automatic Maps

Tagged: , ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #15298
    Kevin Mamaqi
    Participant

    Hello,

    Yesterday I started using mappress plugin and it works very well.

    I got a field called direction and I wanted to create the map directly from it and it did work, now, the problem is that I also wanted two more things:

    – Custom icons.
    – Get the post title, thumbnail and excerpt for the POI description.

    For the custom icons I downloaded a set and uploaded them to the uploads/mappress/icons folder, the icons appears when I am editing a map manually, but, I wanted to assign depending on different terms. I used this code for it:

    function myiconid($iconid, $poi) {
    
      global $post;
    
      $postid = ($poi->postid) ? $poi->postid : $post->ID;
    
      if (has_term('museos', $postid))
    
        return 'museum';
    
      if (has_term('monumentos', $postid))
    
        return 'monument';
    
      if (has_term('discotecas', $postid))
    
        return 'club';
    
      if (has_term('parques', $postid))
    
        return 'park';
    
      if (has_term('bares', $postid))
    
        return 'bar';
    
      if (has_term('restaurantes', $postid))
    
        return 'restaurant';
    
      return $iconid;
    
    }
    
    add_filter('mappress_poi_iconid', 'myiconid', 10, 2);

    To obtain the titles, thumbnail and post description I uploaded this template to my child-theme folder (map-poi.php):

    <div class='mapp-iw'>
      <?php
        global $post;
        $postid = ($poi->postid) ? $poi->postid : $post->ID;
      ?>
      <div class='mapp-title'>
        <?php echo $poi->get_title_link(); ?>
      </div>
      <div class='mapp-body'>
        <?php echo $poi->get_thumbnail(array('class' => 'mapp-thumb')); ?>
        <?php echo get_post_meta($postid, 'test', true); ?>
        <?php echo $poi->get_body(); ?>
      </div>
      <div class='mapp-links'>
        <?php echo $poi->get_links(); ?>
      </div>
    </div>

    I think that the codes that I am using are ok, so I would like to restart all the maps to see if them change. I updated all posts and nothing happens, and also tried to edit two of them manually and it didn’t work either.

    #15299
    Chris
    Keymaster

    Hi,

    Automatic maps are re-created only when the post is published, and only if the checkbox ‘overwrite existing maps when saving’ is set on the MapPress settings screen. If that checkbox is set, manual changes will be overwritten each time you save/publish.

    The custom icons filter and the poi template are only used when displaying a map (NOT when editing it or viewing it in the post editor). You’ll only see those functions when you preview a post, and you don’t need to re-publish to make them active.

    If you’re previewing the post and not seeing them, try a simpler test – use just the template, or just the icons.

    If you like, send or post a URL as well, so I can see if there’s a javascript error.

    #15303
    Kevin Mamaqi
    Participant

    Hello Chris,

    Thanks for your help, my site is http://www.euroviajar.com, here is a destination post with a map: http://www.euroviajar.com/discoteca-egg-de-londres/ – this post has been updated and nothing happen. Also I removed the icons code from the functions.php and the POI still displays the same instead of post info.

    I want to use custom icons, post name, thumbnail and description in the POI.

    #15304
    Chris
    Keymaster

    Hi,

    Let’s address the update first – I don’t understand what you mean by the post has been updated but nothing happens. What do you expect to happen?

    Publishing the post can be used to re-create an automatic map with a new location. It has no effect on the POI display or custom icons filter.

    Please try updating the location for an existing post and let me know what happens:
    1. Check you have ‘overwrite existing maps’ checked in the settings
    2. Edit a post with a map named ‘automatic’ that was created from the ‘directions’ field
    3. Change the ‘directions’ field to ‘Paris’.
    4. Publish the post

    The ‘automatic’ map should now show a marker on Paris. If it doesn’t, there should be a custom field called ‘mappress_error’ that will tell you why.

    #15305
    Kevin Mamaqi
    Participant

    Hello Chris,

    I just updated the direction of this post: http://www.euroviajar.com/museo-sherlock-holmes-en-londres/

    Before doing it I saw again the mappress options and Overwrite existing maps when updating was checked, also I changed the map size from 425×300 to 100%x300.

    As you can see the post still have the same width (I also tried the Permanently resize existing maps option and it doesn’t work).

    But anyway, what I really want is to have a custom icon depending on the post tags and display post thumbnail, title and excerpt into each POI. How can I do this and update the maps?

    Thanks.

    #15306
    Chris
    Keymaster

    Hi,

    When a post is published, any existing automatic map is deleted and re-created – with the default size. Any changes you made are deleted.

    If you want to permanently change the size of the automatic map, you can use width=”100%” and height=”300″ in the shortcode.

    I don’t see Paris in that map, so it seems like your custom fields are not configured properly, or not working for some reason.

    Please check that you’ve done the following:
    – you have the ‘directions’ field mapped to ‘address’ in the MapPress settings
    – you’ve updated the ‘directions’ custom field – not the map marker – to ‘Paris’ before publishing

    I think it will be easier from here if you email me a login using the contact form. That way I can see what you’re doing and give you more detailed guidance.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.