Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Author.php archive with a CPT

$
0
0

Hi friends of types

Not long ago, you helped me with a function to add an author archive (author.php) to a Custom Post Type that is called "criticas".

This is the function:

 

//Add criticas CPT to author archive

function custom_post_author_archive( $query ) {
    if ( $query->is_author() && $query->is_main_query() ) {
        $query->set( 'post_type', array('criticas', 'post') );
    }
}
add_action( 'pre_get_posts', 'custom_post_author_archive' );

I have also set up an Author "Wordpress Archive" in Views.

Here comes the problem: I have almost 400 wordpress users and some of them have the exact same "user_nicenames".

For example, I can have:

URL 1= http://www.mywebsite.net/blog/author/ana —-> author ID 100
URL 2= http://www.mywebsite.net/blog/author/ana —-> author ID 310

Same URLs but different author ID and different posts. How can I fix this issue? Can you help me please?


Viewing all articles
Browse latest Browse all 20145

Trending Articles