{"id":2369,"date":"2026-10-20T08:32:19","date_gmt":"2026-10-20T07:32:19","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/geodirectory-field-values-in-post-grids\/"},"modified":"2026-10-20T08:40:21","modified_gmt":"2026-10-20T07:40:21","slug":"geodirectory-field-values-in-post-grids","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/code-snippets\/geodirectory-field-values-in-post-grids\/","title":{"rendered":"How to use GeoDirectory field values in page builder post grids"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">GeoDirectory stores listing fields such as the address, phone and your custom fields in its own database table for each post type, for example <code>wp_geodir_gd_place_detail<\/code> for Places. They are not saved as normal WordPress post meta, which is why a page builder&#8217;s list of meta keys does not show them.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are two ways to get them into a grid or template that was not built for GeoDirectory.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Use the geodir_ prefix with get_post_meta()<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">GeoDirectory answers <code>get_post_meta()<\/code> calls for its own fields when you put <code>geodir_<\/code> in front of the field key. Any builder or theme element that lets you type a custom field name and reads it with <code>get_post_meta()<\/code> can use these keys:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>geodir_street<\/code>, <code>geodir_city<\/code>, <code>geodir_region<\/code>, <code>geodir_country<\/code>, <code>geodir_zip<\/code><\/li>\n\n\n\n<li><code>geodir_latitude<\/code> and <code>geodir_longitude<\/code><\/li>\n\n\n\n<li><code>geodir_phone<\/code>, <code>geodir_email<\/code>, <code>geodir_website<\/code><\/li>\n\n\n\n<li><code>geodir_<\/code> plus the key of any custom field you added, for example <code>geodir_property_status<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You will find each field&#8217;s key in Places &gt; Settings &gt; Custom Fields, in the field&#8217;s Key setting. In PHP, inside a theme template or a custom grid element:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">$city   = get_post_meta( get_the_ID(), &#039;geodir_city&#039;, true );\n$status = get_post_meta( get_the_ID(), &#039;geodir_property_status&#039;, true );\n\n\/\/ Or read GeoDirectory&#039;s table directly:\n$street = geodir_get_post_meta( get_the_ID(), &#039;street&#039;, true );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">These return the value as saved in the database, so a select field gives you the stored option value and the business hours field gives its raw schedule string.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Use the GD Post Meta shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If the builder element accepts shortcodes, <code>&#091;gd_post_meta&#093;<\/code> outputs a field formatted the way GeoDirectory shows it, with an icon and label if you want them:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-markup\">&#091;gd_post_meta key=&#039;property_status&#039; show=&#039;value&#039;&#093;\n&#091;gd_post_address show=&#039;icon-value&#039;&#093;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Inside a loop the shortcodes pick up the current listing. Outside a loop, add <code>id=&#039;123&#039;<\/code> with the listing ID. The <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/core-widgets\/shortcode-builder\/\">shortcode builder<\/a> lists every option, and <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/core-widgets\/gd-post-meta\/\">GD &gt; Post Meta<\/a> explains each one.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you only need GeoDirectory listings in a grid, it is usually easier to design a GD archive item template and show it with GD &gt; Listings, as described in <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/core-widgets\/gd-listings\/\">GD &gt; Listings<\/a>. For Enfold and other Avia based themes see <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/how-tos\/how-to-display-gd-content-in-avia-theme\/\">How to Display GD Content in Avia Theme<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GeoDirectory stores listing fields such as the address, phone and your custom fields in its own database table for each post type, for example wp_geodir_gd_place_detail for Places. They are not saved as normal WordPress post meta, which is why a page builder&#8217;s list of meta keys does not show them. There are two ways to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[211,433],"class_list":["post-2369","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\/2369","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=2369"}],"version-history":[{"count":2,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2369\/revisions"}],"predecessor-version":[{"id":2651,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2369\/revisions\/2651"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=2369"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=2369"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=2369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}