-
-
Save About2git/03f781bc2a5d6ce47115 to your computer and use it in GitHub Desktop.
How to replace Display Author when using Byline plugin in Genesis.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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