Plugin Author
wpseek
(@alphawolf)
Hi Rebecca,
sorry for the late reply. Please update the plugin to version 1.7.4 and add the following code to your theme’s functions.php file:
if( function_exists('get_coauthors') ) {
add_filter( 'sya_the_authors', 'my_sya_filter_authors', 10, 2 );
function my_sya_filter_authors( $author, $post ) {
$coauthors = get_coauthors( $post->ID );
$authorsCollection = array();
foreach( $coauthors as $coauthor ) {
if( $coauthor->display_name ) {
$authorsCollection[] = $coauthor->display_name;
}
}
return implode(', ', $authorsCollection);
}
}
THANK YOU SO MUCH! IT WORKED!
Could you also tell me how to make the author names into active links to their author archive pages?
Thanks!
Also, how do I remove the parenthesis () around the author names?
Plugin Author
wpseek
(@alphawolf)
Hi Rebecca,
adding author links to the author names would be possible by adding the following code snippet to your theme’s functions.php file (replacing the one I posted above):
if( function_exists('get_coauthors') ) {
add_filter( 'sya_the_authors', 'my_sya_filter_authors', 10, 2 );
function my_sya_filter_authors( $author, $post ) {
$coauthors = get_coauthors( $post->ID );
$authorsCollection = array();
foreach( $coauthors as $coauthor ) {
if( $coauthor->display_name ) {
$authorsCollection[] = '<a href="' . get_author_posts_url( $coauthor->ID, $coauthor->user_nicename ) . '">' . $coauthor->display_name . '</a>';
}
}
return implode(', ', $authorsCollection);
}
}
As for removing the parenthesis around the author names: That not possible as this part of the plugin’s output that can’t be hooked into. You could be trying to use CSS to hide the text while keeping the links with:
.sya_container .sya_author {
color: transparent;
}
The problem is that if then “by” becomes transparent as well. Why did you decided to put the authors name in parenthesis? Maybe you could put a span around the Parenthesis so people can hide it with css. Thanks for your quick response!!
I am using the shortcode to include a category several times on one page to show archives by category. Random posts are showing the wrong author. When I deactivate the coauthor plugin, it works, but when I reactivate, it shows some correct authors, and some incorrect authors.
http://besacenter.org/publications-archive/
Look under Mideast Security and Policy Studies in 2008 and you’ll see the posts are attributed to ManagingTeam even thought that isn’t the correct author if you click on the post title.
How can I show the correct authors?
Plugin Author
wpseek
(@alphawolf)
Hi Rebecca,
when looking under Mideast Security and Policy Studies in 2008 I see 3 posts attributed to 3 different authors each. The authors seem correct to me compared to when I click the titles and check the post author.
Am I missing sth.?
I fixed it by clicking “Update” on each post. Crazy but true.
Plugin Author
wpseek
(@alphawolf)
Weird, but glad to hear it’s working now.