Viewing 1 replies (of 1 total)
  • Anonymous User 7698158

    (@anonymized-7698158)

    Yes.

    I added this to my functions.php file:

    add_action( 'pre_get_posts', 'aeprofiles_change_sort_order_custom',99 );
    /**
     * Add pagination and sort by menu order for aeprofiles archives
     */
    function aeprofiles_change_sort_order_custom( $query ) {
    
        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
        if( $query->is_main_query() && !is_admin() && is_post_type_archive( 'aeprofiles' ) || is_tax() ) {
    
            $query->set( 'orderby', 'rand' );
            $query->set( 'order', 'ASC' );
            $query->set( 'paged', $paged );
        }
    }
Viewing 1 replies (of 1 total)
  • The topic ‘I would like to sort the archive page random’ is closed to new replies.