Skip to content

Instantly share code, notes, and snippets.

@greenhornet79
Last active September 12, 2023 21:30
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 greenhornet79/4ce6562168e36f85e7e0b6ddf7a901ca to your computer and use it in GitHub Desktop.
Save greenhornet79/4ce6562168e36f85e7e0b6ddf7a901ca to your computer and use it in GitHub Desktop.
<?php
function zeen_override_byline($orig_author, $post_ID) {
$authors = ''; /* get the coauthors */
if ( function_exists( 'get_coauthors' ) ) {
$coauthors = get_coauthors($post_ID); /* if no coauthors then just user the original author */
} else {
$coauthors = array();
}
if ( count($coauthors) == 0 ) {
$author_id = get_post_field('post_author', $post_ID);
$authors = '<a href="' . get_author_posts_url($author_id ) . '" title="View all posts by ' . $orig_author . '">' . $orig_author . '</a>';
} else {
foreach( $coauthors as $coauthor ) {
$authors .= ((strlen($authors) > 0) ? '&nbsp;,&nbsp;' : '') . '<a href="' . get_author_posts_url( $coauthor->ID ) . '" title="View all posts by ' . $coauthor->display_name . '">' . $coauthor->display_name . '</a>';
}
}
return $authors;
}
add_filter( 'issuem_author_name', 'zeen_override_byline', 999, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment