WordPress.org

Ready to get started?Download WordPress

Forums

List post title of authors in his/her profile (1 post)

  1. Midhun007
    Member
    Posted 1 year ago #

    I have 6 authors in my blog page. I have profile for each of the authors on the same page. I want to show the posts of the authors dynamically under their own profile. I tried the following but it didn't work the way I expected. What changes should i make?

    function my_get_display_author_posts() {
    
    $current_author = get_query_var('author');
    $author_posts=  get_posts( 'author='.$current_author->id.'&posts_per_page=-1' );
    if($author_posts){
     echo '<ul>';
    foreach ($author_posts as $author_post)  {
     echo '<li><a href="'.get_permalink($author_post->ID).'">'.$author_post- >post_title.'</a></li>';
    }
    echo '</ul>';
    }
    }

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags