I went over an effective way to put more social network handles into your WordPress profile without having to use a plugin, as well as being able to call it to your template in case you have an author’s box somewhere within your single post template.
This time, we are not going to have to tinker with your functions.php page.
To create a new page, you will need to specify that you are making a new template. This one will be called author.php
You want it styles somewhat similar to your other pages, but you can add the following and style it according to your own template. The code contains the gravatar, 3 different social network handles, and a simple listing of the author’s posts. You can customize it to display excerpts, display excerpts with thumbnails, full posts, and more.
<!-- This sets the $curauth variable -->
<?php
if(isset($_GET['author_name'])) :
$curauth = get_userdatabylogin($author_name);
else :
$curauth = get_userdata(intval($author));
endif;
?>
<div class="post-top">
<div class="post-title">
<h2>About: <?php echo $curauth->display_name; ?></h2>
<p style="float:left;padding-right:10px;"><a href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>">
<?php echo get_avatar($curauth->user_email, '96', $avatar); ?>
</a></p><p style="float:left;">Connect with <?php echo $curauth->display_name; ?> at: <a href="http://twitter.com/<?php echo $curauth->twitter; ?>"><strong>Twitter</strong></a> | <a href="http://facebook.com/<?php echo $curauth->facebook; ?>"><strong>Facebook</strong></a> | <a href="http://linkedin.com/in/<?php echo $curauth->linkedin; ?>"><strong>LinkedIn</strong></a></p>
<br />
<h3><strong>Website:</strong> <span><a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></span></h3>
<p><strong>Profile:</strong> <?php echo $curauth->user_description; ?><p>
</div></div>
<div class="entry">
<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>
In order for people to be able to see your author, simply add the following within your post’s byline:
Written by <span><?php the_author_posts_link(); ?></span>
This is actually from my own template from Blondish.net. In fact, this is what my author profile looks like at Blondish.net.
AnotherBlogg3r says
Hi Nile.
Is there any plugin for show author profile and short bio with number of post?
Thanks
My recent post How To Targeting Local Search?
Nile says
There is a plugin for the author info I believe, but as for the page, no. At least none I have seen yet. You need to create a template for that. You are using StudioPress on your site still, right?… Just take your page.php and copy it. Open the file up and put the info from this tutorial in it.
The code I gave above can be broke done below the author code. I will probably go back and make hidden note notations so it is easy to tell what is what.
If you do decide you need help, all I would need is a copy of your css style sheet and your page.php so I keep your site consistent.
Amy says
Hi Nile.
Is there any plugin for show author profile and short bio with number of post?
Thanks
My recent post How To Targeting Local Search?
Nile says
You just need to copy the code above as the tutorial says and you can alter your theme. The one above has author profile, combined with social network profiles (which I covered in another tutorial) and some links to your most recent posts.
You can customize it to show the profile with your gravatar and then excerpts as well.
aarondas says
Hello Nile,
I have a quesion about <?php the_author_posts_link(); ?>. I am trying to use this in a member directory that I have, which will list members by Last_name,first_name. I want to be able to link this to their profile. would I do it like this
< a href=&rdquo ;http://www.example.com/<?php echo the_author_login($auser['nicename']); ?>/”><?php echo $auser['last'].", ".$auser['first']; ?>< /a>
or would I simply put it as
< a href=&rdquo ;http://www.example.com/<?php echo the_author_login(); ?>/”><?php echo $auser['last'].", ".$auser['first']; ?>< /a>
Thank you,
Aaron
Mike Andy says
Thanks dear… exactly what i was looking for.. <3 <3