I want to create an author archive for only custom post type. This page will includes only custom posts by the author.
And url structure should be example.com/portfolio/author/author-name/
I don’t want to include custom type to default author.php because my custom post type is in different language.
According to this blogpost you just need to add the following code to your themes functions.php
or in a plugin:
/* Add CPTs to author archives */
function custom_post_author_archive($query) {
if ($query->is_author)
$query->set( 'post_type', array('custom_type', 'post') );
remove_action( 'pre_get_posts', 'custom_post_author_archive' );
}
add_action('pre_get_posts', 'custom_post_author_archive');