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

Home Forums Feature Requests Show a get directions link in post

This topic contains 13 replies, has 3 voices, and was last updated by  alim 1 year, 3 months ago.

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

    Joseph Barrett
    Participant

    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!

    #45499

    Eyal Fitoussi
    Keymaster

    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.

    #45528

    Joseph Barrett
    Participant

    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. http://maps.google.com/maps?saddr=&daddr=PostCoordinatesGoHere 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?

    #45679

    Eyal Fitoussi
    Keymaster

    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?

    #45690

    Joseph Barrett
    Participant

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

    #45717

    Joseph Barrett
    Participant

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

    #45727

    Eyal Fitoussi
    Keymaster

    Try this:

    #45728

    Eyal Fitoussi
    Keymaster

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

    #45754

    Joseph Barrett
    Participant

    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="http://maps.google.com/maps?saddr=&daddr=<?php echo do_shortcode('[gmw_post_info info="lat"]'); ?>,<?php echo do_shortcode('[gmw_post_info info="long"]'); ?>" target="_blank" >Get Directions</a>

    #45794

    Eyal Fitoussi
    Keymaster

    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

    #45998

    Joseph Barrett
    Participant

    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!

    #48795

    Eyal Fitoussi
    Keymaster

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

    #57109

    alim
    Participant

    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 ,

    #57110

    alim
    Participant
    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.