Forum: Feature Requests

This forum is closed for new topics. However, you can still search for a solution in the old topics. For technical support related to the Feature Requests premium extension please open a new premium support ticket.

[Resolved]Show a get directions link in post

Forums Feature Requests Show a get directions link in post

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
  • #44084

    I need to add a get directions link that functions the same as in the search results. The gmw_single_location  shortcode has a get directions link but asks for the current address when clicked.  I would like the link to just open google maps in a new page as it is clicked and populate “your location” as the from locaion. Just like on the search results . Does that make sense?

    Thank You Sir!


    Hi Joseph,

    It does make sense. I am now working on the next major update of GEO my WP and I will be adding new shortcakes and functions. I will look into adding this feature as well.


    I don’t really need a shortcode for it, but I can’t write up the correct php to generate the right url. For example, I have no idea how to call that post’s lng+lat in to a google URL. I just don’t know how to get pull the address or coordinates from the post location and put it in the link in the template. What would you suggest?


    If you are going to place the directions link via PHP ( in a template file ) then you can use the function gmw_get_post_location_from_db( $post_id ) the get the post’s location.
    So you can do something like:

    Does this help?


    ABSOLUTELY! I was missing the from_db.I’ll try this today. Thanks Sir!


    Yeaaaaa, i cant get it to write the coords in to the link… i am NOT a php developer thats for sure


    Try this:


    Make sure to replace &#038 with & in the directions link. The code got a bit messed up.


    nah, it renders the link but the $latlng is still empty in the href. I just slapped some <?php ?> around your code though in the post template. I will continue to mess around with it. Thanks man.

    I can use shortcodes to do this, which is ok, and now I feel i HAVE to make it work without using shortcodes LOL

    <a href="<?php echo do_shortcode('[gmw_post_info info="lat"]'); ?>,<?php echo do_shortcode('[gmw_post_info info="long"]'); ?>" target="_blank" >Get Directions</a>


    Are you sure the $post_id you are passing is correct?

    Usually to get the post ID in a single template file you need to do


    That did it I know even less about wp than i know about php! you are a great teacher i really appreciate your time and help!


    You are welcome Joseph. I am glad I could help.


    Hellow sir eyal .
    ihave same question to but , it from difrent activity.
    how can i delcare the get drection link to status user from buddypress gmw ?.
    I know the function already exists, but it’s just declare href for the country code and location name, how to convert it to lat,long code? ,
    thanks before sir ,

    This reply has been marked as private.
Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.