Support » Plugins and Hacks » [Plugin: Co-Authors Plus] List all post by autor-coauthor?

[Plugin: Co-Authors Plus] List all post by autor-coauthor?

  • 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?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Daniel Bachhuber


    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).

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Co-Authors Plus] List all post by autor-coauthor?’ is closed to new replies.