Support

Home Forums Event Espresso Premium Venue listings not in alphabetical order?

Venue listings not in alphabetical order?

Posted: March 30, 2015 at 1:49 pm


Simon Belcher

March 30, 2015 at 1:49 pm

Hi guys,

Where is the venue listing order governed from? At the moment it seems random:

http://ee.stagebe.co.uk/venues/

Any ideas?


Lorenzo Orlando Caum

  • Support Staff

March 30, 2015 at 2:08 pm

Hi Simon, the venues listing page order is set in reverse chronological order by the published date.


Lorenzo


Simon Belcher

April 13, 2015 at 1:06 pm

Is there a way to change it to alphabetical? Or even better categorised by county?


Dean

April 14, 2015 at 6:03 am

Hi Simon,

You could use a function to modify the venue list before it is displayed. The below is a basic example:

function wpse63424_filter_pre_get_posts( $query ) {

    //stop this from affecting the amdin
    if( is_admin() ) {
	return $query;
    }
    //stop the main query from being affected
    if ( ! is_main_query() ) {
        return $query;
    } else {
        if ( is_espresso_venue_archive() ) {
            $query->set( 'orderby', 'name' );
            $query->set( 'order', 'ASC' );
        }
        return $query;
    }
}
add_filter( 'pre_get_posts', 'wpse63424_filter_pre_get_posts' );

It is based off of this post: http://wordpress.stackexchange.com/questions/63424/how-to-modify-the-loop-in-archives-php-to-have-11-posts-per-page-and-css-styling

The support post ‘Venue listings not in alphabetical order?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso