Posted By

florent on 10/21/11


Tagged

wordpress


Versions (?)

Insert author bio for each post


 / Published in: PHP
 

  1. function get_author_bio ($content=''){
  2. global $post;
  3.  
  4. $post_author_name=get_the_author_meta("display_name");
  5. $post_author_description=get_the_author_meta("description");
  6. $html="<div class='clearfix' id='about_author'>\n";
  7. $html.="<img width='80' height='80' class='avatar' src='http://www.gravatar.com/avatar.php?gravatar_id=".md5(get_the_author_email()). "&default=".urlencode($GLOBALS['defaultgravatar'])."&size=80&r=PG' alt='PG'/>\n";
  8. $html.="<div class='author_text'>\n";
  9. $html.="<h4>Author: ".$post_author_name."</h4>\n";
  10. $html.= $post_author_description."\n";
  11. $html.="</div>\n";
  12. $html.="<div class='clear'></div>\n";
  13. $content .= $html;
  14. }
  15.  
  16. return $content;
  17. }
  18.  
  19. add_filter('the_content', 'get_author_bio');

Report this snippet  

You need to login to post a comment.