Home › Forums › Calendar Products › Community Events › Modifying the events list query
- This topic has 5 replies, 2 voices, and was last updated 6 years, 6 months ago by cary.
-
AuthorPosts
-
September 1, 2017 at 7:53 am #1343628caryParticipant
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?
September 4, 2017 at 6:56 pm #1344662JenniferKeymasterHi 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
September 5, 2017 at 7:37 am #1344835caryParticipantI 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.
September 8, 2017 at 11:16 am #1346804JenniferKeymasterHi 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
September 30, 2017 at 9:35 am #1357296Support DroidKeymasterHey 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 -
AuthorPosts
- The topic ‘Modifying the events list query’ is closed to new replies.