How To Add an Custom Author Page For WordPress

Some WordPress blogs have multiple authors. But their themes haven’t custom author pages. In today’s post, I will teach you how to create a WordPress custom author page.

Here is the code that a standard theme would use between the header and sidebar/footer calls:

<?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>
<p><strong>Website:</strong> <a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></p>
<p><strong>Profile:</strong> <?php echo $curauth->user_description; ?></p>
<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: ?>
<p><?php _e('No posts by this author.'); ?></p>
<?php endif; ?>
<!-- End Loop -->
</ul>

If you want your authors name link to point towards the authors page, you can do so with the following code:

<?php the_author_posts_link(); ?>

You also can accomplish this through WordPress author plugin.

3 Best Free Author Bio Box Plugins for WordPress

Enjoy!

Related Posts

How to check wordpress theme for malicious code