• Resolved rafaelvidal

    (@rafaelvidal)


    I’m using categories of events on my website menu.
    So, for the category: “meetings” I have a “Meetings” button on the menu.
    General events are displayed under the “Events” button.

    I could reverse the order of all events using this function:

    add_action('pre_get_posts','wpse50761_alter_query',15);
    function wpse50761_alter_query($query){
    if( $query->is_main_query() && is_post_type_archive('event')){
    	$query->set('orderby','eventstart');
    	$query->set('order','DESC');
    	}
    }

    But I couldn’t figure out how to reverse order of categories (“meetings”, “promotions”).

    MENU STRUCTURE

    Home
    Contact
    About Us
      Team
      Company
    Events (/events/event/)
      Meetings (events/category/meetings/)
      Promotions (events/category/promotions/

    https://www.ads-software.com/plugins/event-organiser/

Viewing 1 replies (of 1 total)
  • Thread Starter rafaelvidal

    (@rafaelvidal)

    RESOLVED

    add_action('pre_get_posts','wpse50761_alter_query',15);
    function wpse50761_alter_query($query){
    if( $query->is_main_query() && is_post_type_archive('event') || is_tax('event-category') ){
    	$query->set('orderby','eventstart');
    	$query->set('order','DESC');
    	}
    }

    changed “if” row; added ” || is_tax(‘event-category’) ” at the end of the if condition.

Viewing 1 replies (of 1 total)
  • The topic ‘CHANGE DISPLAY ORDER’ is closed to new replies.