CCCPaste

code-snippet

is_main_query() && is_author() ) {
        // Get the filtered arguments
        $default_args = array(
            'items'   => get_option('posts_per_page', 12),
            'orderby' => 'date',
            'order'   => 'DESC'
        );
        $atts = apply_filters( 'avf_author_loop_args', $default_args, 'author' );
        
        // setup for Query-Parameters
        $query->set( 'posts_per_page', $atts['items'] );
        $query->set( 'orderby', $atts['orderby'] );
        $query->set( 'order', $atts['order'] );
    }
}, 1 );


// Example: Different layouts for different authors
/*
add_filter( 'avf_author_loop_args', function( $atts, $context ) {
    if( $context == 'author' ) {
        $author_id = get_query_var( 'author' );
        
        // Individual configuration for specific authors
        if( $author_id == 1 ) { // commonly the Admin
            $atts['type']     = 'grid';
            $atts['columns']  = 3;
            $atts['contents'] = 'excerpt_read_more';
        } else {
            $atts['type']     = 'grid';
            $atts['columns']  = 4;
            $atts['contents'] = 'title';
        }
    }
    return $atts;
}, 10, 2);
*/