• Resolved candy2012

    (@candy2012)


    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….

    https://www.ads-software.com/extend/plugins/mappress-google-maps-for-wordpress/

Viewing 1 replies (of 1 total)
  • 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

Viewing 1 replies (of 1 total)
  • The topic ‘Template tag please’ is closed to new replies.