Hiya
I’d like to sort posts in ascending order and have found this article, however i’d only like this to happen on one category. Is that possible?
thanks
Richard
Hey raslade,
Try using is_category: https://developer.wordpress.org/reference/functions/is_category/
The code should look something like:
add_filter('avia_blog_post_query', 'avia_modify_post_grid_query_desc');
function avia_modify_post_grid_query_desc( $query ) {
if( is_category( 'blue-cheese' ) ) {
$query['orderby'] = 'title';
$query['order'] = 'DESC';
return $query;
}
}
Just change the value inside is_category. Let us know if this helps.
Best regards,
Nikko
Hi Nikko
That’s fantastic thank you and works fine.
Thanks for your help
Richard
Hey!
Thanks a lot for letting us know.
Please remember to vote for Enfold at Themeforest, we would really appreciate it!
Please feel free to let us know if we can do anything else for you.
Regards,
Basilis