Hello,
I need assistance with changing the sort order for a specific post slider and a specific post grid on my website. Specifically, I would like to sort the articles in these two blocks in reverse chronological order, from the oldest to the newest. Could you please guide me on how this can be accomplished?
Thank you for your help.
Hey Paolo,
Thank you for the inquiry.
You can use the avia_post_slide_query filter to adjust the default sorting order of the post slider. If you wish to apply this customization to a post element on a specific page, you can include conditional functions like is_page. Example:
add_filter('avia_post_slide_query', 'avia_post_slide_query_mod');
function avia_post_slide_query_mod( $query ) {
if( is_page(123) )
{
$query['orderby'] = 'date';
$query['order'] = 'ASC';
}
return $query;
}
Replace 123 with the actual ID of the page.
Best regards,
Ismael