{"id":994,"date":"2025-03-24T14:28:13","date_gmt":"2025-03-24T14:28:13","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/how-to-hide-the-end-date-for-events\/"},"modified":"2025-04-03T15:24:34","modified_gmt":"2025-04-03T14:24:34","slug":"how-to-hide-the-end-date-for-events","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/how-tos\/how-to-hide-the-end-date-for-events\/","title":{"rendered":"How to hide the End Date for Events?"},"content":{"rendered":"\n<p>All events have an end date &#8211; nothing lasts forever, right?<\/p>\n\n\n\n<p>But just because the end date is required to make all the GeoDirectory event features work &#8211; that doesn&#8217;t mean you have to display the end date on your site.<\/p>\n\n\n\n<p>Here is one way you can make the display of the end date conditional using the <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/core-widgets\/gd-dynamic-content\/\" target=\"_blank\" rel=\"noopener\">GD Dynamic Content<\/a> widget.<\/p>\n\n\n\n<p><strong>Overview<\/strong><\/p>\n\n\n\n<p>To make the End Date display by default, but allow listing owners to hide it, we will first create a new field &#8220;Hide display of End Date&#8221; and then turn off other event data displays and then replace it that with a series of shortcodes.<\/p>\n\n\n\n<p><strong>Steps<\/strong><\/p>\n\n\n\n<p>Visit your Events CPT Settings for custom fields<\/p>\n\n\n\n<p>Add a new Checkbox field and label it &#8220;Hide display of Event End Date&#8221;<\/p>\n\n\n\n<p>Open the field advanced options to set the key as &#8216;event_end_date_hide&#8217;<\/p>\n\n\n\n<p>Save the field<\/p>\n\n\n\n<p>Adjust up the event date default display<\/p>\n\n\n\n<p>Open the event date field options<\/p>\n\n\n\n<p>Find the option &#8216;Show in extra output locations&#8217; and turn off all displays by clicking the X<\/p>\n\n\n\n<p>Save the field<\/p>\n\n\n\n<p>Open GD Details or GD Archive item template<\/p>\n\n\n\n<p>Paste in these shortcodes where you want the dates to display.&nbsp;<\/p>\n\n\n\n<p>Those shortcodes together will display the start date and time, then &#8211; if the field &#8216;end_date_hide&#8217; is not checked, then it will display the end date.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-html\">&#091;gd_post_meta key=&quot;event_start_date_time&quot; show=&quot;value-raw&quot; no_wrap=&quot;1&quot;&#093;\n\n&#091;gd_dynamic_content key=&quot;end_date_hide&quot; condition=&quot;is_not_empty&quot;&#093;\n    &#091;gd_post_meta key=&#039;event_end_date_time&#039; show=&#039;value-raw&#039; no_wrap=&#039;1&#039;&#093;\n&#091;\/gd_dynamic_content&#093;\n<\/code><\/pre>\n\n\n\n<p>These shortcodes are created with the GeoDirectory <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/core-widgets\/shortcode-builder\/\">Shortcode Builder<\/a>.<br><br><strong>Configuration of Dynamic Content in the Shortcode Builder<\/strong><\/p>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-alert d-flex align-items-center fade show alert alert-warning mb-3\" role=\"alert\"><span class=\"fas fa-exclamation-triangle me-2\"><\/span><span class=\"flex-grow-1\">When including shortcodes in the Text option, it is necessary to swap out all the double quotes for single quotes. This is some information you should read<\/span><\/div>\n","protected":false},"excerpt":{"rendered":"<p>All events have an end date &#8211; nothing lasts forever, right? But just because the end date is required to make all the GeoDirectory event features work &#8211; that doesn&#8217;t mean you have to display the end date on your site. Here is one way you can make the display of the end date conditional [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[854,855,862],"article\/categories":[211,432],"class_list":["post-994","gd_place","type-gd_place","status-publish","hentry","gd_place_tags-dates","gd_place_tags-event-dates","gd_place_tags-examples","gd_placecategory-tips-tricks-more","gd_placecategory-how-tos"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/994","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=994"}],"version-history":[{"count":0,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/994\/revisions"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=994"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=994"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=994"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}