Waze

This topic contains 7 replies, has 4 voices, and was last updated by  Naveen Giri 4 years, 4 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #518870

    gaz36f
    Expired Member
    Post count: 54

    I have tried adding the following code to the functions.php page (I also tried using the snippets plugin) to get a URL link to Waze using the longitude and latitude address tags.

    However, despite previous success by others in V1, I cannot get it to work for Waze in V2. Any suggestions please?

    function geodirectory_detail_page_waze_map_link() {
    global $post, $preview;

    if ( !$preview && !empty( $post->post_latitude ) && !empty( $post->post_longitude ) ) {
    $maps_url = add_query_arg( array(
    ‘?’ => $post->post_latitude . ‘,’ . $post->post_longitude,
    ), ‘https://waze.com/ul’ );
    ?>
    <p>” target=”_blank”><?php echo __( ‘Get Directions on Google Maps’, ‘geodirectory’ ); ?></p>
    <?php
    }
    }
    add_action( ‘geodir_after_description_on_listing_detail’, ‘geodirectory_detail_page_waze_map_link’);

    #518871

    Kor
    Moderator
    Post count: 16516

    Hi gaz36f,

    Thanks for your post. I’ve forwarded this to a developer for further assistance.

    Thanks!

    #518872

    gaz36f
    Expired Member
    Post count: 54

    Thanks Kor!

    #518928

    Alex Rollin
    Moderator
    Post count: 27815

    Please try that with a badge. You should be able to use replace tags for lat and lon like %%latitude%% and %%longitude%% just like %%input%%

    https://wpgeodirectory.com/docs-v2/design/gd-badge/

    https://developers.google.com/waze/deeplinks

    #518991

    gaz36f
    Expired Member
    Post count: 54

    Hi Alex, yes, that is what I thought too. I tried it yesterday but I have just attempted it again since your post. Sadly, it doesn’t work.

    If I put the %%latitude%% and %%longitude%% in the ‘Badge Text’ field, it recognizes the co-ordinates and duly enters them, as text.

    However, if I use the same address tags in the ‘Badge Link URL’ field (i.e. https://waze.com/ul?%%latitude%%%%longitude%% ), it doesn’t recognize the tag and the URL is quite literally https://waze.com/ul?%%latitude%%%%longitude%% (i.e. no coordinates).

    As a test in this field, I put https://waze.com/ul?%%input%% and it produced https://waze.com/ul?%5Bfirst line of address].

    It looks like the address tags %%latitude%% and %%longitude%% work in the badge text field but not the badge url field.

    #519011

    Naveen Giri
    Moderator
    Post count: 1559

    Hi

    the filter you are using not exist in v2.

    for badge the link attribute only support %%input%% and %%post_url%%
    it not support other tags because of security concern.

    you can use below code in snippet and use [waze_link] as a shortcode to print the link.

    Thanks

    #519016

    gaz36f
    Expired Member
    Post count: 54

    That’s absolutely great Naveen. It worked! 🙂

    Just two very small things:

    I added ‘?ll?’ after ‘ul’. I think I might have missed those earlier.

    $maps_url = ‘https://waze.com/ul?ll=%%latitude%%,%%longitude%%’;

    Also, if other people use this they might want to change the ‘Google’ to ‘Waze’ in this line here:

    <?php echo __( ‘Get Directions on Waze Maps’, ‘geodirectory’ ); ?>

    So happy to have this. Thanks again Naveen. Cheers, Gary

    #519028

    Naveen Giri
    Moderator
    Post count: 1559

    Thanks for confirmation and I am glad it works as per expectation.

Viewing 8 posts - 1 through 8 (of 8 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket