{"id":987,"date":"2025-03-24T14:28:12","date_gmt":"2025-03-24T14:28:12","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/hide-google-maps-controls-with-a-snippet\/"},"modified":"2025-04-03T15:24:33","modified_gmt":"2025-04-03T14:24:33","slug":"hide-google-maps-controls-with-a-snippet","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/code-snippets\/hide-google-maps-controls-with-a-snippet\/","title":{"rendered":"Hide Google maps controls with a snippet"},"content":{"rendered":"\n<p>To hide the street view square you can use some CSS or a code snippet.<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" class=\"attachment-large size-large\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-Qxmjafutpa.png\" sizes=\"auto, (max-width: 264px) 100vw, 264px\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-Qxmjafutpa.png 264w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-Qxmjafutpa-234x300.png 234w\" alt=\"\" width=\"264\" height=\"338\">CSS<\/p>\n\n\n\n<p>Add this to your custom CSS<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-css\">.gm-svpc img { position: initial !important; }<\/code><\/pre>\n\n\n\n<p>Code Snippet<\/p>\n\n\n\n<p>Add this <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/useful-plugins\/code-snippets-plugin\/\" target=\"_blank\" rel=\"noopener\">code snippet<\/a> for more control<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">\/**\n * Remove Map Type and Street View controls from Google maps.\n *\/\nfunction gd_snippet_190814_map_params( $params, $map_args ) {\n\t$map_type = $params&#091;&#039;map_type&#039;&#093;;\n\t$map_canvas = $params&#091;&#039;map_canvas&#039;&#093;;\n\n\t\/\/if ( $map_canvas == &#039;gd_map_canvas_directory&#039; ) {\n\t\t\/\/$params&#091;&#039;mapTypeControl&#039;&#093;       = false; \/\/ Map Type control\n\t\t$params&#091;&#039;streetViewControl&#039;&#093;    = false; \/\/ Street View control\n\t\/\/}\n\n\treturn $params;\n}\nadd_filter( &#039;geodir_map_params&#039;, &#039;gd_snippet_190814_map_params&#039;, 20, 2 );<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>To hide the street view square you can use some CSS or a code snippet. CSS Add this to your custom CSS Code Snippet Add this code snippet for more control<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[211,433],"class_list":["post-987","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-tips-tricks-more","gd_placecategory-code-snippets"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/987","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=987"}],"version-history":[{"count":0,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/987\/revisions"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=987"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=987"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=987"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}