Plugin Author
Ajay
(@ajay)
Can you show me what the output you’re currently displaying?
One option is to filter crp_author to get all the authors and return the output you choose
Look at the sidebar: https://www.sicilianmarketing.it/rivista/consenso-bis-la-corte-di-giustizia-torna-sui-requisiti-di-un-valido-consenso-privacy/
The post called: ‘Articolo di prova’ has 2 authors, but only one has been displayed in the sidebar widget.
Plugin Author
Ajay
(@ajay)
Untested, but you could try this in your theme’s functions.php
function crp_coauthor( $crp_author, $author_info, $result ) {
$coauthors = get_coauthors( $result->ID );
$crp_author = '<span class="crp_author"> ' . __( ' by ', 'contextual-related-posts' );
foreach ( $coauthors as $author ) {
$author_link = get_author_posts_url( $author->ID );
$author_name = ucwords( trim( stripslashes( $author->display_name ) ) );
$authors[] = '<a href="' . $author_link . '">' . $author_name . '</a></span>';
}
$crp_author .= implode( ', ', $authors );
return $crp_author;
}
add_filter( 'crp_author', 'crp_coauthor', 10, 3 );
it works perfectly! Thanks!
Plugin Author
Ajay
(@ajay)
Thank you for confirming – I had to tweak some HTML in the earlier post.
https://github.com/WebberZone/code-library/blob/master/contextual-related-posts/crp-coauthor.php
Check out the updated code at the link above
-
This reply was modified 2 years, 11 months ago by Ajay.