• Resolved rvitalia

    (@rvitalia)


    I’d order a archive custom post type.
    I use the function to order archive
    add_action( ‘pre_get_posts’, ‘my_change_sort_order’);
    function my_change_sort_order($query){
    if(is_archive()):
    //Set the order ASC or DESC
    $query->set( ‘order’, ‘ASC’ );
    //Set the orderby
    $query->set( ‘orderby’, ‘date’ );
    endif;
    };

    how do I order the archive of the custom post type?

    • This topic was modified 5 years, 9 months ago by rvitalia.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Archive Order’ is closed to new replies.