WordPress.org

Ready to get started?Download WordPress

Forums

MapPress Easy Google Maps
Template tag please (2 posts)

  1. candy2012
    Member
    Posted 1 year ago #

    Hi,

    How do I add the map for each post or custom post type?
    The shortcode idea does not fit, as I do not want to insert a specific map, but a map dynamically for each post.

    So, should be something like a generic template tag, which I was unfortunately unable to find!

    You have that option "insert map automatically at the top or bottom of the post", but I do not want it at the top or bottom, but on a totally different position withing the template.

    Sounds easy, was impossible to find the info though....

    http://wordpress.org/extend/plugins/mappress-google-maps-for-wordpress/

  2. saas
    Member
    Posted 1 year ago #

    Hi candy2012,

    I was also unable to find any template tag or such.

    So I hacked the code,

    I used this:
    echo do_shortcode('[mappress]');

    what it do is,

    // Determine what to show
    		$mapid = (isset($atts['mapid'])) ? $atts['mapid'] : null;
    		$meta_key = $options->metaKey;
    
    		if ($mapid) {
    			// Show map by mapid
    			$map = Mappress_Map::get($mapid);
    		} else {
    			// Get the first map attached to the post
    			$maps = Mappress_Map::get_post_map_list($post->ID);
    			$map = (isset ($maps[0]) ? $maps[0] : false);
    		}

    looks for mapid passed to shortcode if found none then looks for any attache maps to current post and show / display it.

    hope it helps you.

    Note: this is not an ideal solution but works for now, hoping developer will provide elegant solution soon.

    Syed

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.