Skip to content

Instantly share code, notes, and snippets.

@About2git
Forked from srikat/functions.php
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save About2git/03f781bc2a5d6ce47115 to your computer and use it in GitHub Desktop.

Select an option

Save About2git/03f781bc2a5d6ce47115 to your computer and use it in GitHub Desktop.
How to replace Display Author when using Byline plugin in Genesis.
<?php
//* Do NOT include the opening php tag
add_filter( 'genesis_post_info', 'sk_post_info_filter' );
/**
* If a Post has at least 1 Byline, display all Bylines linking to their archive pages
* Otherwise show the native WordPress Post's author.
*
* @author Sridhar Katakam
* @link http://sridharkatakam.com/replace-display-author-using-byline-plugin-genesis/
*/
function sk_post_info_filter( $post_info ) {
$author = get_the_term_list( '', 'byline', '', ', ', '' );
if ( $author && !is_admin() && !is_feed() ) {
$post_info = '[post_date] by ' . get_the_author() . '[post_comments] [post_edit]';
} else {
$post_info = '[post_date] by [post_author_posts_link] [post_comments] [post_edit]';
}
return $post_info;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment