How To Add Author Details With Gravatar In Wordpress Posts

How To Add Author Details With Gravatar In Wordpress Posts

var fbShare = {url: ‘http://pcandweb.com/tutorials/how-to-add-author-details-gravatar-wordpress-post.html’,size:’large’} Many of you are having multi author blogs and may feel the need to show the author details on every posts published, some of you may have simple author but then also you’d like to add author details coz it looks kinda cool. Most of the premium professional themes [...]

Author : Subhadeep

Author's Website | Articles from Subhadeep

Hello! I started PCANDWEB because i wan't to share what little knowledge i have with the world. You can find me on Twitter!

Many of you are having multi author blogs and may feel the need to show the author details on every posts published, some of you may have simple author but then also you’d like to add author details coz it looks kinda cool. Most of the premium professional themes comes with the added bonus but as i’m a free theme lover and hope you’re too, we can easily add it to our blog. I’ll show you how i added it in this blog and show you the different ways you can add it in your blog.

The Code

<div id=”post_author” class=”clearfix”>
<?php echo get_avatar( get_the_author_email(), ‘80′ ); ?>
<div class=”author_desc”><h4>Author : <?php the_author_posts_link(); ?></h4>
<p><?php the_author_description(); ?></p></div>
</div>

This will create a author info like i have in my every post. Lets analyse the code,

get_avatar(get_the_author_email(),’80′) , imports the avatar from gravatar, 80 is the size you can change it if you want to.

the_author_posts_link(), imports the link to which all the posts of author are shown, you can also change it to some other options like author sitename, IM etc, checkout the functions listed below.

the_author_description(), its self explanatory it imports the description added by the author in users option in admin panel.

Some other functions you can try can be found here : Template Tags ( Check Author Tags)

The CSS

Ofcourse everyone knows the output have to be styled, heres the default CSS i use for my site, you can change it to what ever suits your need.

#post_author {
border: 1px solid #E8E8E8;
background: #EBF6FB;
padding: 10px;
margin: 20px auto 20px auto;
}
#post_author img {
float: left;
border: 1px solid #E8E8E8;
}
#post_author h4 {
font-size: 1.4em;
margin-bottom: 5px;
font-family: Arial, Helvetica, sans-serif;
}
#post_author p {
margin: 0;
padding: 0;
}
.author_desc {
padding-left: 95px;
}

If you don’t understand the CSS and need any type of help with modification of style ask in comment, me or some other users will surely answer or you can also try some basic tutorials on internet on CSS.

How To Add

The biggest question aint it, if your a geek you already figured out if not heres the process,

  1. Open style.css in your template and at the end of all CSS codes just paste the CSS lines in red above.
  2. Open single.php and find <?php the_content( ” ); ?> now if you want the author description to appear at the start of every post just paste the PHP Code high above in red, just before the line <?php the_content( ” ); ?>, if you want it to appear at end of every post paste it below the line <?php the_content( ” ); ?>

Please Check The Following Images For Example :

CSS Example

CSS Example

php

PHP Example

And your professonal author description is ready, add more details in the php using the other functions and change it to suit your needs its all upto you.

Like this post? Share it!

  • Diggit
  • Delicious
  • Diggit
  • Diggit

Related Posts


User Comments


  1. lawrence77
    May 5th

    wow!
    Cool tips for beginners! :)

    lawrence77’s last blog post..Daily Inspiration #3

    Reply


  2. sbq
    Aug 31st

    thanks, just what I was looking for (i dropped a word for you on the wp forum)

    Reply


  3. Mr.Carrot33
    Oct 22nd

    I learned a lot from this website. ,

    Reply


  4. BrandonSch
    Dec 16th

    Great post , You hit the
    mark with this, I just don’t understand why people quite get what you’re saying.
    I don’t know how many individuals I’ve talked to about this very
    thing in the past month, and they just can’t get it.

    , Excellent post!

    Reply


  5. ~ew
    Dec 26th

    Hello,

    Do note that, as of Wordpress 2.9, the recommended way to query the author’s mail is by calling
    the_author_meta('user_email');

    Reply


  6. LarryLove
    Feb 25th

    Hey very nice blog!!….I’m an instant fan, I have bookmarked you and I’ll be checking back on a regular….See ya :)

    Reply

Leave a Reply

Show Your Last Blog Post
Rss Feeds   Twitter Followers Email Updates

Community Feeds

  • Create a Delicious Type Treat

    If you want to take your 3D typography skills to the next level, then we have an awesome tutorial for you. Learn how to create two tasty type effec…

  • 27 Must-Have Starter Kits For Web Designers

    Starter kits are great timesavers for web designers and they are particularly useful for those who often create mock-ups for project pitching on da…

  • 60+ Awesome Wordpress Tutorials

    Here I have compile a list of “how to create your own WordPress theme” tutorials/articles. I hope this can save your time on searching and pay …

Submit More