WordPress.org

Ready to get started?Download WordPress

Forums

Co-Authors Plus
List all post by autor-coauthor? (3 posts)

  1. bouman_mister
    Member
    Posted 2 years ago #

    Hi
    I'm working for hours and I don't find the solution.

    I want list all post of ONE author/coauthor; but with use coauthors_IDs(); or same (coauthors();) appears all about two authors.

    My simplified code:

    <?php $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
    ?>
    <h2>Posts of <?php echo $curauth->display_name; ?>:</h2>
    <?php global $post;
      $coautores = coauthors_IDs();
      $args = array('numberposts' => 500, 'author' => $coautores );
      $myposts = get_posts( $args );
        foreach( $myposts as $post ) : setup_postdata($post); ?>
    
    <div> <?php the_title(); ?> </div>
    <?php } endforeach; ?>

    What I make wrong?
    Thanks.

    http://wordpress.org/extend/plugins/co-authors-plus/

  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    Is this in your author.php template?

    If you'd like to pull all of the posts from one author, you'll want to change $coautores = coauthors_IDs(); to $coautores = $curauth->ID;. This sets the $cuautores variable to the value of the author ID.

    Unfortunately, it's conceptually somewhat difficult to pull in the posts of two authors on to an author page if the second author isn't known. You can use the same template tags within the loop to show multiple authors on the page though (one will always be the author for which the template page is for).

  3. bouman_mister
    Member
    Posted 2 years ago #

    Hi, yes this code is in author.php.

    With $curauth->ID; only load posts when author is the first acredited.
    Why don't load the posts of this author is second acredited?

    when is the second acredited of post, don't appears.

    Understand what the problem?

    Thanks for the Help.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic