How to hide the End Date for Events?

All events have an end date - nothing lasts forever, right?

But just because the end date is required to make all the GeoDirectory event features work - that doesn'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 using the GD Dynamic Content widget.

Overview

To make the End Date display by default, but allow listing owners to hide it, we will first create a new field "Hide display of End Date" and then turn off other event data displays and then replace it that with a series of shortcodes.

Steps

Visit your Events CPT Settings for custom fields

Add a new Checkbox field and label it "Hide display of Event End Date"

Open the field advanced options to set the key as 'event_end_date_hide'

Save the field

Adjust up the event date default display

Open the event date field options

Find the option 'Show in extra output locations' and turn off all displays by clicking the X

Save the field

Open GD Details or GD Archive item template

Paste in these shortcodes where you want the dates to display. 

Those shortcodes together will display the start date and time, then - if the field 'end_date_hide' is not checked, then it will display the end date.

<p>[gd_post_meta key="event_start_date_time" show="value-raw" no_wrap="1"]</p> <p>[gd_dynamic_content key="end_date_hide" condition="is_not_empty"][gd_post_meta key='event_end_date_time' show='value-raw' no_wrap='1'][/gd_dynamic_content]</p>

These shortcodes are created with the GeoDirectory Shortcode Builder.


Configuration of Dynamic Content in the Shortcode Builder

When including shortcodes in the Text option it is necessary to swap out all the double quotes for single quotes. Compare the first and second shortcodes to see the difference.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us