Hi, I’ve been trying in vein to re-organise posts so that they appear in alphabetical order. Most of my posts in the specified category are arranged alphabetically, but some are out of order: http://www.tractor-dealers.net/category/tractors/
I’ve modified the functions.php to include:
if( $query->is_category( pinboard_get_option( 'TRACTORS' ) ) ) {
$query->set( 'orderby', 'title' );
$query->set( 'order', 'ASC' );
}
Can anyone give an explanation why not all posts are being rendered alphabetically? Thanks
-
This topic was modified 9 years, 5 months ago by garyjudge.
The is_category()
function is not available in the pre_get_posts
hook. You can use this code instead:
if( isset( get_query_var( 'cat' ) ) && 38 == get_query_var( 'cat' ) )
Replace 38 with the ID of your tractors category.