Friday, 12th March 2010

How to Add a Custom Author Profile Page to Your WordPress

Posted on 01. Nov, 2009 by WP Beginner in WPbeginner's Articles 

When you have a multi-author blog, it is wise to add an author’s profile page to your WordPress blog. An author page bring the readers close to their favorite authors by having some background information listed in their profile. Sadly, most free WordPress themes do not come with a custom author.php which is why this tutorial can be helpful. In this tutorial, we will be showing you how to add a custom author profile page to your WordPress blog.

Because most free themes do not have a custom author.php file, WordPress automatically callback to archive.php or index.php when someone views the author profile page. The problem with that is that it will only list all the posts written by the author, and it provides no personal information about the author.

It is recommended that you copy your archive.php and save it as author.php and then add the codes from the sample below to customize your page matching the theme settings:

<?php get_header(); ?>

<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;
?>

<h2>About: <?php echo $curauth->nickname; ?></h2>
<dl>
<dt>Website</dt>
<dd><a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></dd>
<dt>Profile</dt>
<dd><?php echo $curauth->user_description; ?></dd>
</dl>

<h2>Posts by <?php echo $curauth->nickname; ?>:</h2>

<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>,
<?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; ?>

<!– End Loop –>

</ul>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

This page above will display: Author’s nickname, their website, background information (whatever you put in the description field), and a list of posts written by this specific author. All of the background detail and information will be handled from the Profile page in the admin panel. There are other plugins that will let you add pictures and other extra features in multi-author blogs.

Now that you have created the custom author profile page, you want to make sure that your single.php, and in some cases your index.php both are pointing to the author’s profile link when the name is mentioned. Often when themes do not provide a custom author page, they tend to link to author’s website URL in the “written by” section of each post. So you should search for words like Written by or something along the same line and replace the codes with this snippet, and if you do not have that code, then you want to add the code below anyways in order to provide your users with a link to author’s profile page.

<p>Written by:
<?php the_author_posts_link(); ?></p>

Another great way of letting your users know about author profiles page is simply by listing all authors from your blog on one page, or in the sidebar. We have written an article about this in the past that provides both a raw code solution and a plugin solution, so check out our article on how to list all authors from your blog in WordPress.

To add more parameters, you should refer to the Official WordPress Codex Author Templates page.

No related posts.

3 Responses to “How to Add a Custom Author Profile Page to Your WordPress”

  1. rismaka 1 November 2009 at 10:28 pm #

    Waduh gan, info yang sangat bagus gan :mrgreen:
    Sayangnya blog saya cuma satu author, jadi belum perlu bikin yang kek di atas :mrgreen:

    Lanjut gan :lol:
    Katanya mau hiatus, kok cepet banget? :mrgreen:

  2. lia 5 November 2009 at 11:09 am #

    hai.. salam kenal,,
    lia’s last blog.. A Necessary Loan for Your Problem My ComLuv Profile

  3. ganda 14 December 2009 at 10:41 am #

    wah bro, katanya comment ku yang sebelumnya dinyatakan spam. di recovernya. :D
    ganda’s last blog.. [Enhancement] Programmatically Update Wordpress Admin Password Once A Month My ComLuv Profile


Leave a Reply

CommentLuv Enabled

Please fill the required box or you can’t comment at all. Your e-mail address will not be published.

Polite behaviour is a must. Comments with unkind words won't be tolerated.

Best regards. Abbie