Have you read the codex page Author Templates? There it states:
when a viewer clicks on a link to a post author, by default he or she is taken to a page listing the posts from that particular author in chronological order
This depends on having the correct links setup, which can be done with the_author_posts_link()
or wp_list_authors()
. A custom query shouldn’t be necessary, you can alter the post types by hooking into pre_get_posts
.
Code:
function wpse124293_cpts_for_author_archives( $query ) {
if ( ! $query->is_main_query() || is_admin() )
return;
if ( is_author() ) {
//only show cpt audio
$query->set( 'post_type', array( 'audio' ) );
//to show builtin post and cpt audio use: array( 'post', 'audio' )
}
}
add_action( 'pre_get_posts', 'wpse124293_cpts_for_author_archives' );