Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stefanpejcic/303f75a3d58da2d9911c0eac1f6c5f87 to your computer and use it in GitHub Desktop.
Save stefanpejcic/303f75a3d58da2d9911c0eac1f6c5f87 to your computer and use it in GitHub Desktop.
WordPress custom author page template
<div id="content" class="narrowcolumn">
<!-- This sets the $curauth variable -->
<?php if(isset($_GET['author_name'])) : $curauth = get_userdatabylogin($author_name); else : $curauth = get_userdata(intval($author)); endif; ?>
<h3>About: <?php echo $curauth->display_name; ?></h3>
<strong>Website:</strong> <a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a>
<strong>Profile:</strong> <?php echo $curauth->user_description; ?>
<h3>Posts by <?php echo $curauth->display_name; ?>:</h3>
<ul>
<!-- The Loop -->
<?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>
</li>
<?php endwhile; else: ?>
<?php _e('No posts by this author.'); ?>
<?php endif; ?>
<!-- End Loop -->
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment