Home › Forums › Calendar Products › Events Calendar PRO › orderby additional column
- This topic has 3 replies, 2 voices, and was last updated 6 years, 2 months ago by Michael Stenitzer.
-
AuthorPosts
-
January 30, 2018 at 9:41 am #1439891Michael StenitzerParticipant
Dear Support!
I know that the events are ordered by EventStartDate by default. What we need, is to first order it by a different column (ACF), and then order it by the start date. The customer needs a way to move specific events to the top or bottom.
What we currently have is this:
'meta_key' => 'sorting_exhibitions',
'orderby' => 'meta_value_num',
'order' => 'ASC'
which is part of the argument list that tribe_get_events() gets.Unfortunately the StartDate in the query now gets overwritten by our sorting_exhibitions column, and the events are now only ordered by that column.
Is there any other way to archive what we want (with tribe_get_events)?Many thanks.
February 2, 2018 at 11:06 am #1442752SkyKeymasterHi Michael!
We are limited in the amount of support we can provide for customizations such as this, but I will try to help get you pointed in the right direction.
The tribe_get_events() function has a filter “tribe_get_events” that can be used to override the query. There are two possibilities I can think of here. The first idea is to run two separate queries and then combine them together before passing into the filter. The first query would sort by posts that have the custom ACF field. The second query would sort by date. The trick here would be to remove any posts from the second array that are already in the first before combining the arrays.
The second possibility is that there may be a way to do this in a single query. WordPress has added improvements on how queries work over the last few years. Unfortunately, I am not caught up on the specifics of the new features, so I am not going to be much help with this option.
I apologize that I don’t have anything more specific than this to offer you. If you do come up with a solution, feel free to share it here for future users who may want to do the same thing.
Thanks,
SkyFebruary 24, 2018 at 8:35 am #1462846Support 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 ‘orderby additional column’ is closed to new replies.