Modifying the events list query

Home Forums Calendar Products Community Events Modifying the events list query

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1343628
    cary
    Participant

    I would like to add a custom field to events to define if they are on a single day or multiple days. I would then like to modify the query that displays all the events to change the sort order.

    Where do I find the query that lists the events (I believe it sorts them now by starting date), so that I can modify it?

    #1344662
    Jennifer
    Keymaster

    Hi Cary,

    Thanks for reaching out! You can find the main query at wp-content/plugins/the-events-calendar/src/Tribe/Query.php.

    Adding a custom field to events will require a bit of a customization – I would recommend taking a look at our themer’s guide as a starting point. You may also want to look into the custom fields that come with Events Calendar Pro, which could save you some serious development time if they will do what you need!

    If you get stuck or have any questions, please let me know!

    Thanks,

    Jennifer

    #1344835
    cary
    Participant

    I have Events Calendar Pro but it looks like ‘custom fields’ is just for collecting additional data for the actual event. What I’d like to do is basically sort the results by date descending, (multi day) asc. Right now if an event goes on for 5 months, it always shows on top which is not ideal.

    #1346804
    Jennifer
    Keymaster

    Hi Cary,

    Thanks for clarifying! Good news – in this case, you should not need to add a custom field, but instead you can use the tribe_event_is_multiday function to check for multi-day events, then you can use the result to sort accordingly.

    Let me know if that works for you!

    Thanks,

    Jennifer

    #1357296
    Support Droid
    Keymaster

    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

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Modifying the events list query’ is closed to new replies.