Home › Forums › Calendar Products › Events Calendar PRO › Display Past Events in Reverse Order Snippet
- This topic has 3 replies, 2 voices, and was last updated 9 years, 2 months ago by Brook.
-
AuthorPosts
-
December 6, 2014 at 11:57 am #910252marthamcevoyParticipant
Regarding the snippet from this thread:
https://theeventscalendar.com/support/forums/topic/display-past-events-in-reverse-order/
which is here:
https://gist.github.com/elimn/0be6c4cbcf80b3721c81
I have encountered a problem. On my page, in addition to the past events list (which I would like in reverse order), I also have the upcoming events widget (which I want in forwards order). The snippet is causing them both to reverse.December 8, 2014 at 2:30 pm #912322BrookParticipantHowdy Martha,
Thank you for reporting this. I had not thought to test it with that widget on the same page. I will give this a whirl and see if I can come up with a way to limit it. I will get back to you.
– Brook
December 17, 2014 at 10:30 pm #922292BrookParticipantHowdy again Martha,
I really appreciate your pointing this out. Last week was so busy with our new version launch that I did not have time to investigate a solution and possible reqrite the snippet. Today I made the time, investigated, and I have not come up with a snippetable fix. There are forces conspiring here that basically make the two queries appears virtually identical, namely the list widget and regular list query.
The only fix I can think of is to add some identifying information to our widget that will prevent this from happening. If we create a theme override for that widget ( /pro/widgets/list-widget ), then add in a variable like $tribe_is_widget and set it true, then we can modify the snippet to check for that variable. So we would make that var a global, and change this line:
if ( tribe_is_past() || $past_ajax ) {
to:
if ( tribe_is_past() && $tribe_is_widget !== true || $past_ajax ) {
You would also want to set $tribe_is_widget to false on the last line of your theme override, if your widgets appear before the content on your page.
I really wish there was a better option. This is the only solution I can find though if you are running both on the same page. I hope the above does not sound like gibberish. If it does, that snippet is probably just not going to work for you.
Does that make sense? Is there anything I can clarify?
– Brook
February 5, 2015 at 11:19 pm #940438BrookParticipantSince this has gone for a while without a response I am going to archive the topic. However, if you still need help with this or anything else, please feel free to open a new topic. Cheers!
– Brook
-
AuthorPosts
- The topic ‘Display Past Events in Reverse Order Snippet’ is closed to new replies.