0

I'm using CPT-UI plugin to create custom post types. I have created 'News' CPT with everything works well but when I click on author name which takes me to the author archive page (https://example.com/author/author_name/) it does not load the posts owned by the author. It fetches nothing found template and it shows the wrong author name in the title.

If anybody already ran into this issue please tell me what's going wrong.

0

Solution: 1. Please add this code in your theme’s or child theme’s functions.php file:

function get_user_id() {
 $author = get_user_by( 'slug', get_query_var( 'author_name' ) );
 return $author->ID;
}
add_shortcode( 'get_user_id', 'get_user_id' );
  1. Register the ‘get_user_id’ shortcode first in Toolset >> Settings >> Front-end Content >> Third-party shortcode arguments.

  2. Then use shortcode like this in the Author Archive View:

    [wpv-user field="user_login" id="[get_user_id]"] [wpv-user field="profile_picture" id="[get_user_id]"]

WP Author Templates are below, currently we are talking about author.php: https://codex.wordpress.org/Author_Templates#Which_Template_File_is_Used.3F

Relevant Documentation: https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-user

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.