Skip to content

Instantly share code, notes, and snippets.

@braddalton
Last active August 29, 2015 14:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save braddalton/40de0535abb5ff9c063f to your computer and use it in GitHub Desktop.
Save braddalton/40de0535abb5ff9c063f to your computer and use it in GitHub Desktop.
<?php get_header(); ?>
<div id="content" class="narrowcolumn">
<div class="author">
<div class="author-info">
<!-- This sets the $curauth variable -->
<?php
$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
?>
<h2 class="author-subtitle">About <?php echo $curauth->first_name; ?></h2>
<div class="author-avatar"><?php echo get_avatar( get_the_author_meta( 'user_email' ), 230 ); ?></div>
<dl>
<h5 class="author-subtitle"><dt>Social Follow</dt></h5>
<dd><a class="author-twitter-link" href="<?php echo $curauth->twitter_link; ?>"><?php echo $curauth->twitter_link; ?></a></dd>
<dd><a class="author-facebook-link" href="<?php echo $curauth->facebook_link; ?>"><?php echo $curauth->facebook_link; ?></a></dd>
<dd><a class="author-google-link" href="<?php echo $curauth->google_link; ?>"><?php echo $curauth->google_link; ?></a></dd>
<dd><a class="author-rss-link" href="<?php echo $curauth->rss_link; ?>"><?php echo $curauth->rss_link; ?></a></dd>
<dd><a class="author-email-link" href="mailto:<?php echo $curauth->user_email; ?>"><?php echo $curauth->user_email; ?></a></dd>
<h5 class="author-subtitle"><dt>Website</dt></h5>
<dd><a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></dd>
<h5 class="author-subtitle"><dt>Profile</dt></h5>
<dd><?php echo $curauth->user_description; ?></dd>
</dl>
<h2 class="author-subtitle">Posts by <?php echo $curauth->first_name; ?></h2>
<ul>
<!-- The Loop -->
<div class="author-summary">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<li>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
<?php the_title(); ?></a>,
<?php the_time('d M Y'); ?> in <?php the_category('&');?>
</li>
<?php endwhile; else: ?>
<p><?php _e('No posts by this author.'); ?></p>
<?php endif; ?>
</div><!-- .author-summary -->
</div><!-- .author-info -->
</div><!-- .author -->
<!-- End Loop -->
</ul>
</div>
<?php get_footer(); ?>
add_action( 'wp_enqueue_scripts', 'enqueue_dashicons_front_end' );
function enqueue_dashicons_front_end() {
wp_enqueue_style( 'dashicons-style', get_stylesheet_uri(), array('dashicons'), '1.0' );
}
function author_profile_social_links( $contactmethods ) {
$contactmethods['rss_link'] = 'RSS URL';
$contactmethods['google_link'] = 'Google URL';
$contactmethods['twitter_link'] = 'Twitter URL';
$contactmethods['facebook_link'] = 'Facebook URL';
return $contactmethods;
}
add_filter( 'user_contactmethods', 'author_profile_social_links', 10, 1);
.author-info {
margin: 80px auto;
max-width: 600px;
}
.author-twitter-link:before {
content: "\f301";
color: #00ACED;
-webkit-font-smoothing: antialiased;
font: normal 20px/1 'dashicons';
margin-right: 5px;
margin-top: 5px;
vertical-align: top;
}
.author-twitter-link {
display: inline-block;
line-height: normal;
margin: 10px 0;
color: #fff;
}
.author-facebook-link {
display: inline-block;
line-height: normal;
margin: 10px 0;
color: #fff;
}
.author-facebook-link:before {
content: "\f304";
color: #46629E;
-webkit-font-smoothing: antialiased;
font: normal 20px/1 'dashicons';
margin-right: 5px;
margin-top: 5px;
vertical-align: top;
}
.author-google-link {
display: inline-block;
line-height: normal;
margin: 10px 0;
color: #fff;
}
.author-google-link:before {
content: "\f462";
color: #d34836;
-webkit-font-smoothing: antialiased;
font: normal 20px/1 'dashicons';
margin-right: 5px;
margin-top: 5px;
vertical-align: top;
}
.author-rss-link:before {
content: "\f303";
color: orange;
-webkit-font-smoothing: antialiased;
font: normal 20px/1 'dashicons';
margin-right: 5px;
margin-top: 5px;
vertical-align: top;
}
.author-rss-link {
display: inline-block;
line-height: normal;
margin: 10px 0;
color: #fff;
}
.author-email-link:before {
content: "\f466";
color: #D4D0C8;
-webkit-font-smoothing: antialiased;
font: normal 20px/1 'dashicons';
margin-right: 5px;
margin-top: 5px;
vertical-align: top;
}
.author-email-link {
display: inline-block;
line-height: normal;
margin: 10px 0;
color: #fff;
}
.author {
background-color: #333;
color: #fff;
}
.author-subtitle {
color: #1E8CBE;
}
.author-avatar {
float: right;
margin: 0 30px 20px 0;
padding: 2px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment