Skip to content

Instantly share code, notes, and snippets.

@mjangda
Created February 24, 2010 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjangda/313854 to your computer and use it in GitHub Desktop.
Save mjangda/313854 to your computer and use it in GitHub Desktop.
How to show co-authors when using the Hybrid theme
<?php
add_filter( 'hybrid_byline', 'my_byline' );
function my_byline( $byline ) {
global $post;
if ( 'post' == $post->post_type ) {
$authors_list = '';
if(function_exists('get_coauthors')) {
$coauthors = get_coauthors();
$count = 0;
foreach( $coauthors as $coauthor ) {
if( $count > 0 ) {
if( $count < count($coauthors) - 1 ) {
$authors_list .= ', ';
} else if ( $count >= count($coauthors) - 1 ) {
$authors_list .= __(' and ');
}
}
$authors_list .= get_author_posts_url($coauthor->ID);
$count++;
}
} else {
$authors_list .= get_author_posts_url(get_the_author()->ID);
}
return '<p class="byline">By '. $authors_list .' on [entry-published] [entry-edit-link before=" | "]</p>';
}
return $byline;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment