Hi there, is there a way to sort your category posts without affecting your recent widget posts?
Cheers
Hi there, is there a way to sort your category posts without affecting your recent widget posts?
Cheers
Hello Severo,
Please install and activate the child theme and login through FTP then edit the functions.php of the child theme then add this code:
function cat_alph_sort( $query ) {
$cat_id = get_query_var('cat');
if( !empty($cat_id) && !is_admin() ) {
$query->set( 'orderby', 'title' );
$query->set( 'order', 'ASC' );
}
}
add_action( 'pre_get_posts', 'cat_alph_sort' );
Kindly note that since this is a custom code that changes the default behavior/display of the theme, you will be responsible to maintain or update the code in case you require further changes or if the code stops working in future updates. If you are uncertain how to proceed, it would be best to get in touch with a developer.
Hope this helps.
Hi @SEVERO,
While that is outside the scope of support, I could point you in the right direction with the understanding that it would ultimately be your responsibility to take it from here.
Try the solution provided here, you don’t need to edit the code, you just need it to put on your child theme’s functions.php file, make sure your child theme is active and you clear your caching plugins (if any)
Thanks,
Perfect!
Thank you very much 
You’er welcome 
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.