Help Desk

_EventDuration multi day event

  • Posts: 28 Topics: 17 Answers: 1
    | Permalink

    I have several event feeds on our web site generated by using the Custom Content plugin and the Tribe Events custom post types and meta fields. To differentiate between multi day and single day events I have been using ‘if field=_EventDuration compare=more value=86399’ (86399 is the seconds in 24 hours minus 1), and it’s been working. I just entered three new multi-day events today and they are not being recognized as multi-day by the Custom Content loops. Multi-day events that were entered several months ago are still being recognized properly, and both new and previously entered events are still being recognized as multi-day by the Events Calendar templates.

    I tried switching the duration value to ‘1439’ (minutes instead of seconds), the newly entered events still weren’t recognized as multi-day, although all events entered a while back with a duration over 1439 seconds now were displayed as multiday events.

    I don’t know exactly where the crossover happened because we don’t have that many. Maybe the way duration is stored/calculated changed when the date/time interface changed? How do I specify the duration now for multi-day?

    You can see it on this page: http://www.sierranevada.edu/resources/current-undergraduate-students/. In the 5 items under ‘Event Calendar’, ‘New Student Orientation’ (added today) runs August 14 – August 16. ‘Travel Course – South Africa Service Learning’ and ‘MiddCORE 2017’, which are displaying correctly, were entered several months ago.

    Posts: 28 Topics: 17 Answers: 1
    | Permalink

    I did some more experimenting and found that the _EventDuration field listed on the WordPress post meta page is not being propagated on the newly added events.

    Posts: 6240 Topics: 17
    | Permalink

    Hi Susan!

    Thanks for reaching out to us! Let me help you with that issue.

    When you say:

    the _EventDuration field listed on the WordPress post meta page is not being propagated on the newly added events.

    Do you mean the _EventDuration field is not being saved in the database for the newly added events? If not, where are you seing this info missing? Let us know about it.

    Thanks,
    Victor

    Posts: 28 Topics: 17 Answers: 1
    | Permalink

    To explore what’s going on, I added code on a test page which writes the content of _EventDuration to the page. Events which were added in the past display the duration correctly, in seconds, for short, all day, and multi-day all day events. The recently added events referenced above display nothing for duration. The start and end timestamps are correct for all events.

    Posts: 6240 Topics: 17
    | Permalink

    Hi Susan!

    Thank for coming back explaining what you’ve found so far.

    I made a couple of tests and the event duration is saving correctly for single and multi day events.

    I’m not very familiar with the Custom Content plugin, so I’m not really sure how it works. But, to make sure the _EventDuration postmeta is saving, you should look that up in the database. For example, you could search the post_id (of the event you are having trouble with) in the wp_postmeta table and see if there is a _EventDuration meta_key saved for that venue.

    If there is, then the issue could be related to the Custom Content plugin. If not, then there could be a theme or plugin conflict, so you should go through the testing for conflicts guide here > https://theeventscalendar.com/knowledgebase/testing-for-conflicts/ and see what you find in the process.

    Let me know how that goes and if you have any questions.

    Best,
    Victor

    Posts: 28 Topics: 17 Answers: 1
    | Permalink
    This reply has been marked as private.
    Posts: 6240 Topics: 17
    | Permalink
    This reply has been marked as private.
    Posts: 28 Topics: 17 Answers: 1
    | Permalink
    This reply has been marked as private.
    Posts: 6240 Topics: 17
    | Permalink
    This reply has been marked as private.
    Posts: 28 Topics: 17 Answers: 1
    | Permalink

    I need to be able to distinguish between one day and multi day all day events. One day only the start date displays, multi day both start and end dates display. Checking for start date not equal to end date doesn’t work because the dates are saved as timestamps, and for all day events start TIME is 00:00:00 and end time is 23:59:59. Is there a snippet I could add to our functions.php file that would save the _EventDuration metadata for all events? Thx, Susan

    Posts: 6240 Topics: 17
    | Permalink

    Hi Susan!

    I’d be happy to help you with this.

    First off, I do want to note that we are fairly limited in how much we can support custom development questions like this.

    That said, I’d be happy to at least point you in the right direction as best I can.

    We have a couple of helper functions that will allow you to check if an event is a multi day event or if it’s an all day event. One is tribe_event_is_multiday() and the other one is tribe_event_is_all_day()

    I know you are using the Custom Content plugin, which I’m not very familiar with, but perhaps you can make use of these functions with it.

    We also have a great article that will get you started on customizing our templates here > https://theeventscalendar.com/knowledgebase/themers-guide/

    I hope that helps and let me know if you have other questions.

    Best,
    Victor

    Posts: 65
    | Permalink

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

    | Permalink