Skip to content

Instantly share code, notes, and snippets.

@mattradford
Last active August 29, 2015 14:05
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 mattradford/5d330be574fabb591cfc to your computer and use it in GitHub Desktop.
Save mattradford/5d330be574fabb591cfc to your computer and use it in GitHub Desktop.
WordPress - show an author bio using a custom photo, on an author page
<?php
$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
?>
<h1><?php echo $curauth->display_name; ?>'s blog</h1>
<?php
$publisher_photo = get_the_author_meta('your_photo');
$image_src = wp_get_attachment_image_src($publisher_photo);
if($image_src[0] != NULL) { ?>
<div class="row author">
<div class="two columns mobile-twelve">
<?php echo '<img class="author-picture" src="'. $image_src[0] .'" />'; ?>
</div>
<div class="ten columns mobile-twelve">
<p class="author-bio"><?php echo $curauth->description; ?></p>
<a href="<?php echo site_url(); ?>/about/" class="author-link">Read More</a>
</div>
</div>
<?php } ; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment