Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #679656

    Hi,
    i would like to change the sort order only for the archives (categories). The oldest post should be on the top (Ascending).The Blog on the main page should have the sort order as it is (descending). Is there a way to change this. I have attached the start homepage and as an example an archive page, which I would like to change.

    #681887

    Hey Karsten,

    Thank you for using Enfold. And we would like to apologize for the late response.

    Please add this in the functions.php file to sort the items from oldest posts to the latest:

    function avia_post_slide_query_mod( $query, $params )
    {
        $query['orderby'] = 'date';
        $query['order'] = 'ASC';
        return $query;
     }
     add_filter( 'avia_post_slide_query', 'avia_post_slide_query_mod', 10, 2);
    

    Best regards,
    Ismael

    #682033

    Hi Ismael,

    i have added the code to the functions.php, but after that, the general sort order is changed. But I only want to change the sort order for the archives (categories) and the general sort order should be as it is (from the newest to the oldest posts), as i described within the topic. I have attached you both sides in the privat area. Can you please have a look at it.
    Kind regards
    Karsten

    #683199

    Hi,

    Please change the code to following one

    function avia_post_slide_query_mod( $query, $params )
    {
    if(is_archive()){
        $query['orderby'] = 'date';
        $query['order'] = 'ASC';
    }
        return $query;
     }
     add_filter( 'avia_post_slide_query', 'avia_post_slide_query_mod', 10, 2);

    Best regards,
    Yigit

    #683295

    Hi Yigit,

    perfect and thank you for the support. It’s working and you can close this topic.
    Regards
    Karsten

    #683327

    Hey!

    You are welcome, glad we could help! Let us know if you have any other questions or issues!

    Cheers!
    Yigit

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Sort order for archive pages’ is closed to new replies.