• Resolved jesse9212

    (@jesse9212)


    How can I add conditional code so that start and end times are removed if the event is an all day one?

    I’m also wondering how to conditionally show the start and end date for events that start on one day and end on a different one (ie 2+ Day events).

    This is the format I am adding the times currently:

    add_action( 'tribe_events_after_loop', 'add_past_events' );
    
    function add_past_events() {
        if ( ! tribe_is_list_view() || ! tribe_is_upcoming() ) return;
        remove_action( 'tribe_events_after_loop', 'add_past_events' );
    
        $past_events = tribe_get_events( array(
            'eventDisplay' => 'past'
        ) );
    
        foreach ( $past_events as $event )
    		echo do_shortcode(
    "$event->post_title" .
    tribe_get_start_date( $event->ID, true, 'l, F j, Y') .
    tribe_get_start_date( $event->ID, true, 'g:i a') . ' to ' .
    tribe_get_end_date( $event->ID, true, 'g:i a')
    );
    
    }

    https://www.ads-software.com/plugins/the-events-calendar/

Viewing 1 replies (of 1 total)
  • Plugin Author Brian

    (@brianjessee)

    Hi,

    We use this function to check for all date events:

    tribe_event_is_all_day( $event )

    You can see how we use it in this function:

    tribe_events_event_schedule_details

    In this file:

    plugins/the-events-calendar/src/functions/template-tags/general.php

    Cheers

Viewing 1 replies (of 1 total)
  • The topic ‘Conditionally remove start / end time if all day event’ is closed to new replies.