• This was exactly what I needed. I’m using my page title to set the location and couldn’t do it with any of the Maps that require you to set the location in the block. Those are great if you are putting a map on a page and the address will never change. I’m using this shortcode map on a page I’ve created as a template, thus every page created on that template has a different address, ie a different map.

    Of course it took some coding on my end to use the page title but much less than if I did this without the plugin.

    Much appreciated!!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Alan Fuller

    (@alanfuller)

    That is a neat idea.

    I wonder if the plugin had a filter to apply the arguments that may have made it easier, e.g.

    add_filter('ssg_atts', function($atts) {
    if (is_page()) {
       $atts['address']=get_post()->post_title;
    }
    return $atts;
    }, 10,1 }
    Plugin Author Alan Fuller

    (@alanfuller)

    Just FYI I added a filter sgmsc_atts in the latest release so you can now dynamically change shortcode option is calling via do_shortcode().

    Thread Starter ashebashthecash

    (@ashebashthecash)

    This is the route I went. I put this in WPcode to create a new short code which used your plugin and the post title as address.

    I see you added the zoomControl and gestureHandling to the update!! I added both yesterday after you replied to my support ticket.

    But thank you again for this plugin. I’m not really a coder so what I did below is really the best of my abilities.

    function show_map( ){

    $posttitle = get_the_title();
    $address = $posttitle;

    $show_map = ‘[pw_map address=”‘.$address.'” key=”APIKEY” enablescrollwheel=”false” zoomControl=”false” disablecontrols=”false” gestureHandling=”none” zoom=”13″]’;
    $map = do_shortcode($show_map);

    return $map;
    }
    add_shortcode(‘show_map’, ‘show_map’);`

    Plugin Author Alan Fuller

    (@alanfuller)

    Yes that code is fine and suitable.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Perfect for Page Templates’ is closed to new replies.