{"id":2662,"date":"2026-10-20T08:35:26","date_gmt":"2026-10-20T07:35:26","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/list-all-states-and-cities\/"},"modified":"2026-10-20T08:40:40","modified_gmt":"2026-10-20T07:40:40","slug":"list-all-states-and-cities","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/location-manager\/list-all-states-and-cities\/","title":{"rendered":"How to list all states and the cities in each state"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Use the GD &gt; Locations block, widget or shortcode from the Location Manager add-on. It lists countries, regions (states) or cities, and on a region&#8217;s page it can list just the cities in that region.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Regions and cities aren&#8217;t taxonomies or custom fields. Location Manager keeps its own list of countries, regions and cities, built from your listings&#8217; addresses, and GD &gt; Locations reads from that list.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">List all states<\/h2>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-markup\">&#091;gd_locations what=&quot;region&quot; no_loc=&quot;1&quot;&#093;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>what=&quot;region&quot;<\/code> lists regions. <code>no_loc=&quot;1&quot;<\/code> stops it filtering by the location the visitor is currently viewing, so you always get the full list.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">List the cities in a state<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Add this to your Location page, the page set at GeoDirectory &gt; Settings &gt; General &gt; Pages &gt; Location page:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-markup\">&#091;gd_locations what=&quot;city&quot;&#093;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">When a visitor opens a region, for example by clicking the region in the breadcrumb, the widget picks up the current region and lists only its cities. On the main Location page with no region chosen, it lists all cities.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To list the cities of one particular state anywhere else on your site, give the region slug, and the country slug if the same region name exists in more than one country:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-markup\">&#091;gd_locations what=&quot;city&quot; country=&quot;united-states&quot; region=&quot;texas&quot;&#093;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Display options<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>output_type=&quot;grid&quot;<\/code> shows an image grid instead of a list.<\/li>\n\n\n\n<li><code>per_page<\/code> sets how many locations show on each page. Leave it blank or use <code>0<\/code> to show all.<\/li>\n\n\n\n<li><code>what=&quot;neighbourhood&quot;<\/code> lists neighbourhoods, if you use them.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In GeoDirectory v1 this was done with the Popular Locations widget. Today GD &gt; Locations replaces it. See <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/location-manager\/gd-locations\/\">GD &gt; Locations<\/a> for every setting.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use the GD &gt; Locations block, widget or shortcode from the Location Manager add-on. It lists countries, regions (states) or cities, and on a region&#8217;s page it can list just the cities in that region. Regions and cities aren&#8217;t taxonomies or custom fields. Location Manager keeps its own list of countries, regions and cities, built [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[213,425],"class_list":["post-2662","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-extensions-features","gd_placecategory-location-manager"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2662","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=2662"}],"version-history":[{"count":1,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2662\/revisions"}],"predecessor-version":[{"id":2806,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2662\/revisions\/2806"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=2662"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=2662"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=2662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}