function tweak_category_order( $orderby ) {
if ( ! is_admin() && is_category( XX ) ) {
return "ID ASC"; //or ID DESC
}
//not cat
return $orderby;
}
add_filter('posts_orderby', 'tweak_category_order' );
Use the posts_orderby hook in your themes functions.php file and filter for a category archive to tweak the main query...
Code:function tweak_category_order( $orderby ) { if ( ! is_admin() && is_category( XX ) ) { return "ID ASC"; //or ID DESC } //not cat return $orderby; } add_filter('posts_orderby', 'tweak_category_order' );
Will work for front-end but leave admin posts display as is.
Change the XX to either the id, slug or name as show here: http://codex.wordpress.org/Conditional_Tags
query_posts is the spawn of satan! It throws away the default query and uses a new one so any url parsing is lost. Destroys any functionality that many plugins with additional url parameters require. Just look through a lot of shitty free themes to see how much it is abused!![]()
We use essential cookies to make this site work, and optional cookies to enhance your experience.