{"id":2476,"date":"2026-10-20T08:34:08","date_gmt":"2026-10-20T07:34:08","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/get-directions-button-google-maps\/"},"modified":"2026-10-20T08:38:58","modified_gmt":"2026-10-20T07:38:58","slug":"get-directions-button-google-maps","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/how-tos\/get-directions-button-google-maps\/","title":{"rendered":"How to add a Get Directions button that opens Google Maps"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">GeoDirectory has a GD &gt; Directions widget (shortcode <code>&#091;gd_post_directions&#093;<\/code>) that shows a Get Directions button for the current listing. The button links to Google Maps with the listing&#8217;s latitude and longitude as the destination and opens in a new tab. Google Maps then asks for or uses the visitor&#8217;s own location as the starting point, and on a phone the link can open in the Google Maps app.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The button only shows for listings that have a latitude and longitude, so listings without an address won&#8217;t get one.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Add it to the listing details page<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to GeoDirectory &gt; Settings &gt; General &gt; Pages and note which page is set as the Details Page template.<\/li>\n\n\n\n<li>Edit that page.<\/li>\n\n\n\n<li>Add the GD &gt; Directions block where you want the button, or add <code>&#091;gd_post_directions&#093;<\/code> in a shortcode block.<\/li>\n\n\n\n<li>Update the page.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">You can also add the GD &gt; Directions widget to a sidebar that shows on the details page.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Add it to each listing in your lists<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To show the button on every listing card on category and search pages, edit the page set as the Archive item page template on the same settings screen and add the shortcode there.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Change the text and style<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use the <code>badge<\/code> parameter for the button text and <code>icon_class<\/code> for a Font Awesome icon. For example:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-html\">&#091;gd_post_directions badge=&quot;Directions on Google Maps&quot; icon_class=&quot;fas fa-route&quot; type=&quot;pill&quot;&#093;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The block settings also let you change the colours, size and alignment.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Directions on the listing map<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you would rather show a directions form under the map on the details page, the GD &gt; Map widget has an &#8220;Enable map directions?&#8221; option for single listing maps: <code>&#091;gd_map map_type=&quot;post&quot; map_directions=&quot;1&quot;&#093;<\/code>. More options are in the <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/core-widgets\/gd-directions\/\">GD &gt; Directions<\/a> and <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/core-widgets\/gd-map\/\">GD &gt; Map<\/a> docs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GeoDirectory has a GD &gt; Directions widget (shortcode &#091;gd_post_directions&#093;) that shows a Get Directions button for the current listing. The button links to Google Maps with the listing&#8217;s latitude and longitude as the destination and opens in a new tab. Google Maps then asks for or uses the visitor&#8217;s own location as the starting point, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[211,432],"class_list":["post-2476","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-tips-tricks-more","gd_placecategory-how-tos"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/comments?post=2476"}],"version-history":[{"count":1,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2476\/revisions"}],"predecessor-version":[{"id":2554,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2476\/revisions\/2554"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=2476"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=2476"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=2476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}