Meta keys for start and end times

Home Forums Calendar Products Events Calendar PRO Meta keys for start and end times

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #952237
    dotdash
    Participant

    Hello there,

    Where would I locate the meta keys for the start and end time of an event?

    I can’t find them here: https://theeventscalendar.com/knowledgebase/wordpress-post-meta-data/

    Or, what would I use to display a time frame such as this: 10am – 12pm?

    I am using EVP and WooTickets in conjunction with Essential Grid.

    Cheers,

    Spencer

    #952254
    Matthew
    Member

    Howdy Spencer – great question!

    The times for an event are stored along with the dates, so the meta keys that hold that information are _EventStartDate and _EventEndDate. However, there are a couple of handy functions that will allow you to easily display the date/time in whichever format best suits your needs! Check out tribe_get_start_date() and tribe_get_end_date() – both use PHP date formatting.

    
    // 'ga' outputs the time in 12-hour time with am/pm after it
    echo tribe_get_start_date( $event_id, TRUE, 'ga' ) . ' - ' . tribe_get_end_date( $event_id, TRUE, 'ga' );
    

    Does that point you in the right direction?

    #952552
    dotdash
    Participant

    This reply is private.

    #952580
    Matthew
    Member

    I have never used Essential Grid…it looks like an awesome plugin! Sorry I don’t have more insight into implementation with it.

    As for the code, you should be able to place that in a function in functions.php, perhaps like so:

    
    // obviously rename this function to something that suits you :)
    function my_sweet_event_dates( $event_id ) {
        // 'ga' outputs the time in 12-hour time with am/pm after it
        echo tribe_get_start_date( $event_id, TRUE, 'ga' ) . ' - ' . tribe_get_end_date( $event_id, TRUE, 'ga' );
    }
    

    The tribe_get_start_date() and tribe_get_end_date() functions are awesome for shortening that date, plus you can output both the date and times.

    Hopefully that helps!

    #956750
    Matthew
    Member

    It has been a while since our last communication, so I’m going to go ahead and close out this thread. If you have any other questions, don’t hesitate to start a new one! Thank you 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Meta keys for start and end times’ is closed to new replies.