I would like to display event list order by event title.

Home Forums Calendar Products Events Calendar PRO I would like to display event list order by event title.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1159242
    suhas
    Participant

    I would like to display event list order by event title. I have tried below code. Unfortunately, it doesn’t work. Can you please help me for this,

    add_filter( ‘pre_get_posts’, ‘tribe_change_event_order’, 99 );
    function tribe_change_event_order( $query ) {
    if ( tribe_is_past() || tribe_is_upcoming()) {
    $query->set( ‘orderby’, ‘title’ );
    $query->set( ‘order’, ‘DESC’ );

    }
    return $query;
    }

    #1159535
    Geoff
    Member

    Hi @suhas and welcome back!

    I just tried this snippet and it seemed to do the trick:

    add_action( 'pre_get_posts', 'tribe_post_alphabetical_ordering', 51 );
    
    function tribe_post_alphabetical_ordering( $query ) {
    if( tribe_is_upcoming() ) {
    
    $query->set( 'orderby', 'title' );
    $query->set( 'order', 'DESC' );
    
    }
    }

    That will change the List View of upcoming events to be displayed in descending alphabetical order (Z to A) by event title.

    Does that work for you as well? Please let me know. šŸ™‚

    Cheers!
    Geoff

    #1159624
    suhas
    Participant

    Thank you for the reply. I tried with your code snippet. Unfortunately, it did n’t work.

    #1160327
    Geoff
    Member

    Hmm, that’s no good! It does seem to work when I try it out on my test site.

    While we are fairly limited in how much we can support custom development questions like this, I am happy to point you in the right direction as best I can.

    Is the snippet not working at all? At the very least, it should work when the calendar is in List View showing upcoming events.

    Thanks!
    Geoff

    #1169861
    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 ‘I would like to display event list order by event title.’ is closed to new replies.