Skip to content

Only one co-author showing when editor role #922

@MrBryan

Description

@MrBryan

I posted this on your wordpress plugin page but haven't heard anything so i'll share here:

https://wordpress.org/support/topic/only-one-co-author-showing-when-editor-role/

we have co-authors plus and when a post has multiple authors, it will show in most cases. However, when both, or more than one of the authors has an ‘editor’ role, only one of those with the role will display on the article (because your function is only returning one of them)

We are using a theme based on newspack and I’ve looked at the code where authors are being parsed in inc/template-tags.php and it appears to correctly use the plugin functions :

<span class="byline">
<span><?php echo esc_html__( 'by', 'newspack' ); ?></span>
<?php
foreach ( $authors as $author ) {
$i++;
if ( $author_count === $i ) 
/* translators: separates last two names; needs a space on either side. */
$sep = esc_html__( ' and ', 'newspack' );
elseif ( $author_count > $i ) 
/* translators: separates all but the last two names; needs a space at the end. */
$sep = esc_html__( ', ', 'newspack' );
else :
$sep = '';
endif;
printf(
/* translators: 1: author link. 2: author name. 3. variable seperator (comma, 'and', or empty) */
'<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>%3$s ',
esc_url( get_author_posts_url( $author->ID, $author->user_nicename ) ),
esc_html( $author->display_name ),
esc_html( $sep )
);
}
?>
</span><!-- .byline -->

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions