• Resolved pealo86

    (@pealo86)


    I’m wondering what options are available for ordering events in a query?

    I’m using this code:

    <?php
    	$args = array( 'posts_per_page' => 1,
    				   'eventDisplay' => 'all'
    	);
    
    	$events = tribe_get_events( $args );
    
    ?>
    
    <?php foreach ( $events as $post ) : setup_postdata( $post ); ?>	
    
    	<?php the_title(); ?>
    
    <?php endforeach; ?>
    <?php wp_reset_postdata(); ?>

    But what would I do if I wanted to order events by, say, ‘venue’? Or is it only possible to order them by start date aswell as the default WP ones e.g. ‘title’ etc?

    https://wordpress.org/plugins/the-events-calendar/

Viewing 1 replies (of 1 total)
  • Brook

    (@brook-tribe)

    Howdy pealo86,

    That is a cool idea. Built in that function only supports your classic orderbys like published date because it is basically just a wrapper for get_posts(). It does add the ability to sort by start and end date as well. That’s about it.

    If you would like to do it by venue then you will need to throw in some custom logic. Just treat it like get_posts and you will be golden.

    Cheers!

    – Brook

Viewing 1 replies (of 1 total)
  • The topic ‘Change 'orderby' in query’ is closed to new replies.