WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
Events With No End Date/Time (4 posts)

  1. coreymcollins
    Member
    Posted 2 years ago #

    Just curious about possibly adding support for events that don't specify ending dates/times. For instances, my website lists concerts as its main event type - but they don't really have a scheduled "end time". They start at 7 or 8, then they end when they end.

    I'm not sure if this plugin is still being developed or not, but I would love to see an option to not include an end date/time with an event. I do have SOME events that are weekend events or do have a specific end time, and I would like to be able to display those types of things with an if/else call. I don't really need it there for events that run until they naturally end, though.

  2. g4ry
    Member
    Posted 2 years ago #

    It sorta does have this capability already, but only in the Single event view. The default List view template still shows ending times. I got it to work the way you're describing by creating a custom template for the List view with a few extra lines of code taken from the Single view.

    First, follow the plugin's instructions for creating custom templates. Essentially, you do the following:

    1) Create a subfolder called "events" in your theme's main folder.
    2) Copy the file "/wp-content/plugins/the-events-calendar/views/list.php" into this subfolder. Leave the original file alone, this copy in your theme's folder is the one you want to modify.

    Next, open the new list.php and look for the code that displays the end date (lines 39-42):

    <tr>
    	<td class="tec-event-meta-desc"><?php _e('End:', $spEvents->pluginDomain) ?></td>
    	<td class="tec-event-meta-value"><?php echo the_event_end_date(); ?></td>
    </tr>

    Replace it with this:

    <?php if (the_event_start_date() !== the_event_end_date() ) : ?>
    	<tr>
    		 <td class="tec-event-meta-desc"><?php _e('End:', $spEvents->pluginDomain) ?></td>
    		 <td class="tec-event-meta-value"><?php echo the_event_end_date(); ?></td>
    	</tr>
    <?php endif; ?>

    With this change, just like in the Single event view, any event that has an End date/time that's the same as the Start date/time will not have the event's end time displayed in the List view.

  3. A2JC4life
    Member
    Posted 2 years ago #

    I just discovered that if you enter an end time that is exactly the same as the start time, it will only display the start time. :)

  4. coreymcollins
    Member
    Posted 2 years ago #

    I guess that works, but it'd also be nice if you didn't have to monkey around with an end date/time if you don't actually have one.

    I find that this plug-in also doesn't delete past events, just removes them from the list. I think I'm going to start looking around for a different plug-in that will include those features.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic