Created
April 24, 2016 22:56
-
-
Save Fitoussi/483c22fb8a8094af181e120a50d43c3c to your computer and use it in GitHub Desktop.
GEO my WP - Temporary fix for "Get directions" link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gmw_get_directions_fix( $output, $gmw, $info, $title ) { | |
$title = ! empty( $title ) ? $title : $gmw['labels']['search_results']['directions']; | |
$ulLatLng = ( $gmw['your_lat'] == 'false' || $gmw['your_lng'] == 'false' ) ? '' : "{$gmw['your_lat']},{$gmw['your_lng']}"; | |
$output = '<a class="gmw-get-directions gmw-'.$gmw['prefix'].'-get-directions" | |
title="'.$title.'" | |
href="http://maps.google.com/maps?f=d&hl='.esc_attr( $gmw['language'] ).'®ion='.esc_attr( $gmw['region'] ).'&doflg='.esc_attr( $gmw['units_array']['map_units'] ).'&saddr='.esc_attr( $ulLatLng ).'&daddr='.esc_attr( $info->lat ).','.esc_attr( $info->long ).'&ie=UTF8&z=12" target="_blank">'.esc_attr( $title ).'</a>'; | |
return $output; | |
} | |
add_filter( 'gmw_get_directions_link', 'gmw_get_directions_fix', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment