Created
April 23, 2013 10:13
-
-
Save vajrasar/5442394 to your computer and use it in GitHub Desktop.
Modifying Genesis author box on archive template. Showing author box only when archive is of 'blog' category. Code goes in functions.php
This file contains 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
remove_action( 'genesis_before_loop', 'genesis_do_author_box_archive' ); | |
add_action( 'genesis_before_loop', 'theme_author_box_archive' ); | |
function theme_author_box_archive() { | |
$authinfo = "<div class=\"author-box\">\r\n"; | |
$authinfo .= get_avatar( get_the_author_meta('email', (int) get_query_var( 'author' )), '50' ); | |
$authinfo .= "<b>" . get_the_author_meta('display_name', (int) get_query_var( 'author' )) . "\n </b>"; | |
$authinfo .= "<p>" . get_the_author_meta('description', (int) get_query_var( 'author' )) . "</p>\r\n"; | |
$facebook = get_the_author_meta('facebook_profile', (int) get_query_var( 'author' )); | |
$twitter = get_the_author_meta('twitter_profile', (int) get_query_var( 'author' )); | |
$website = get_the_author_meta('user_url', (int) get_query_var( 'author' )); | |
$flength = strlen($facebook); | |
$tlength = strlen($twitter); | |
if ($website > 1 || $flength > 1 || $tlength > 1) { | |
$authinfo .= "<p id=\"authcontact\"><a href=" . $website . " target=\"_blank\" rel=\"nofollow\">Author's Blog</a> | <a href=" . $twitter . " target=\"_blank\" rel=\"nofollow\">Twitter</a> | <a href=" . $facebook . " target=\"_blank\" rel=\"nofollow\">Facebook</a></p>\r\n"; | |
} | |
$authinfo .= "</div>\r\n"; | |
if ( is_author() && in_category( 'blog' ) ) { | |
echo $authinfo; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment