spot_imgspot_img

Creating a Google Map Link in Views Using an Address Field

There are times when you don’t want to embed a map on your site and you simply want to link an address off to Google maps. Here’s how to do it using address field.

Address field module doesn’t currently have a views formatter to display an address as a link to Google Maps. You could create one. But, for a quick one-off view, this gets the job done.

  1. Add the address field to the view.
  2. Rewrite the output of the field as:

The field name in this case is field_class_location.


<a href="http://maps.google.com/?q=[field_class_location-thoroughfare] [field_class_location-premise][field_class_location-sub_premise] [field_class_location-locality] [field_class_location-dependent_locality] [field_class_location-administrative_area] [field_class_location-sub_administrative_area] [field_class_location-postal_code] [field_class_location-country]">[field_class_location]</a>

Get in Touch

spot_imgspot_img
spot_img

Get in Touch

[td_block_social_counter facebook="tagdiv" style="style6 td-social-boxed" open_in_new_window="y" f_counters_font_family="394" f_network_font_family="891" f_counters_font_size="eyJhbGwiOiIxNCIsImxhbmRzY2FwZSI6IjEzIiwicG9ydHJhaXQiOiIxMiJ9" f_network_font_size="eyJhbGwiOiIxMyIsImxhbmRzY2FwZSI6IjExIiwicG9ydHJhaXQiOiI5In0=" counter_color="#ffffff" counter_color_h="#ffffff" network_color="#ffffff" network_color_h="#ffffff" tdc_css="eyJsYW5kc2NhcGUiOnsibWFyZ2luLWJvdHRvbSI6IjMwIiwiZGlzcGxheSI6IiJ9LCJsYW5kc2NhcGVfbWF4X3dpZHRoIjoxMTQwLCJsYW5kc2NhcGVfbWluX3dpZHRoIjoxMDE5LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMjAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3NjgsInBob25lIjp7Im1hcmdpbi1ib3R0b20iOiI0MCIsImRpc3BsYXkiOiIifSwicGhvbmVfbWF4X3dpZHRoIjo3NjcsImFsbCI6eyJtYXJnaW4tYm90dG9tIjoiNDAiLCJkaXNwbGF5IjoiIn19" twitter="tagdivofficial" youtube="tagdiv"]

Latest Posts