We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
November 27, 2019 at 1:11 pm #518870
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’);November 27, 2019 at 1:22 pm #518871Hi gaz36f,
Thanks for your post. I’ve forwarded this to a developer for further assistance.
Thanks!
November 27, 2019 at 1:24 pm #518872Thanks Kor!
November 28, 2019 at 12:11 am #518928Please try that with a badge. You should be able to use replace tags for lat and lon like %%latitude%% and %%longitude%% just like %%input%%
November 28, 2019 at 7:08 am #518991Hi 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.
November 28, 2019 at 12:32 pm #519011Hi
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
November 28, 2019 at 1:30 pm #519016That’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
November 28, 2019 at 2:56 pm #519028Thanks for confirmation and I am glad it works as per expectation.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket