Display Past Events in Reverse Order Snippet

Home Forums Calendar Products Events Calendar PRO Display Past Events in Reverse Order Snippet

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #910252
    marthamcevoy
    Participant

    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.

    #912322
    Brook
    Participant

    Howdy 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

    #922292
    Brook
    Participant

    Howdy 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

    #940438
    Brook
    Participant

    Since 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

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Display Past Events in Reverse Order Snippet’ is closed to new replies.