To Display Map In Side Bar

Home Forums MapPress Support To Display Map In Side Bar

Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #12621
    zayyar
    Participant

    Currently i am using custom filed to display Google map form front end.
    The great plugin is working well.
    But i would like to display google map in single page side bar instead of displaying in the post body.
    Does anyone can advise how to edit?

    Thanks in advance.

    #12624
    Chris
    Keymaster

    Hi,

    There’s a sidebar widget that comes with the plugin, or you can use the do_shortcode() function in any template file, e.g.:

    #12636
    zayyar
    Participant

    Thank Chris,

    In fact I would like to let user to submit the post with the map address from front end, and i would like automatically display the map on side bar or some where in the page. Is there any chance to dynamically pull the “mapid” for < ?php do_shor tcode(‘[mappress mapid=”1234 “]’); ?> and display the map automatically?

    Thank you.

    #12637
    Chris
    Keymaster

    Hi,

    I’m not sure I understood. If you just want to display the map for the current post, the widget has a ‘current post’ option, or you can use query=”current” in the [mashup] shortcode.

    If you want to use PHP, you can get all the maps for a particular post using Mappress_Map::get_post_map_list($postid).

    For example this should display the first map for the current post:

    <?php
      global $post;
      $maps = Mappress_Map::get_post_map_list($post->ID);
      if (isset($maps[0]))
        echo $maps[0]->display();
    ?>
    #12638
    zayyar
    Participant

    Dear Chris,
    Thank for your great support. By using your php code now I am able to display the map anywhere on my template.
    But I am not able to re-size the map width and height.
    Could you please advise how to pass the parameter like (width,height, zoom) to this php code? Sorry for being novice.
    Thanks you.

    #12641
    Chris
    Keymaster

    Hi,

    You can pass arguments as an array:

    echo $maps[0]->display(array('width' => '50%', 'height: 300px'));

    #12642
    zayyar
    Participant

    Dear Chris,
    Now I am able to re-size the map with your arry :).
    Thank you very much for your great plugin and support.

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