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
March 30, 2015 at 2:08 pm
Add New Note to this Reply
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
Add New Note to this Reply
Is there a way to change it to alphabetical? Or even better categorised by county?
Dean
April 14, 2015 at 6:03 am
Add New Note to this Reply
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