• My site has a Contributors page which lists all posts by each author, including separate entries for co-authors. Until I updated WP and the co-authors plus plug-in a while back the following code worked perfectly. Now co-authored posts only show under the name of the first author.

    I have looked into some older solutions to this problem and tested using a taxonomy in place of the ‘author’ arg, but cannot get it to work. It either displays no posts at all or seemingly random posts under some authors. It seems anyway that this is a more recent problem or that somehow the code I’m using is no longer suitable. Any advice?

    <?php
    //displays all authors with their bios and their posts
    $blogusers = get_users(array(
        'exclude' => array(1, 2, 8),
        'fields'  => 'all_with_meta'
    ));
    // Sort by last name
    usort($blogusers, create_function('$a, $b', 'if($a->last_name == $b->last_name) { return 0;} return ($a->last_name > $b->last_name) ? 1 : -1;'));
    if ($blogusers) {
      foreach ($blogusers as $bloguser) {
        $user = get_userdata($bloguser->ID);
        echo '<br><p class="titleMargin3"><strong>' . $user->user_firstname . ' ' . $user->user_lastname . '</strong></p>';
        $description = get_userdata($bloguser->ID)->user_description;
        echo '<p class="titleMargin3">'.$description.'</p>';
        $args=array(
          'post_type' => 'post',
          'post_status' => 'publish',
          'posts_per_page' => -1,
          'caller_get_posts'=> 1,
          'author' => $user->ID
        );
        $my_query = null;
        $my_query = new WP_Query($args);
        if( $my_query->have_posts() ) {
          echo '<p class="titleMargin3"><span class="setSize2">Contributions:</span></p><p class="titleMargin3">';
          while ($my_query->have_posts()) : $my_query->the_post(); ?>
            <a class="panelLink" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_date('F Y'); ?>: <?php the_title(); ?></a><br>
            <?php
          endwhile;
        }
      wp_reset_query();  // Restore global post data stomped by the_post().
      }
    }
    ?></p>
  • The topic ‘[Plugin: Co-authors Plus] List of posts not displaying for second authors’ is closed to new replies.