WordPress.org

Forums

Get avatar in Author bio theme function (1 post)

  1. jumust
    Member
    Posted 4 years ago #

    Hi,
    I'm using this code in function.php to show up the author bio:

    function get_author_bio ($content=''){
        global $post;
        $post_author_name=get_the_author_meta("display_name");
        $post_author_description=get_the_author_meta("description");
        $html="<div class='clearfix' id='about_author'>\n";
        $html.="<img src='<?php echo get_avatar(get_the_author_meta('user_email'), 96); ?>'/>\n";
        $html.="<div class='author_text'>\n";
        $html.="<h4>Author: <span>".$post_author_name."</span></h4>\n";
        $html.= $post_author_description."\n";
        $html.="</div></div>\n";
        $html.="<div class='clear'></div>\n";
        $content .= $html;
        return $content;
    }
    add_filter('the_content', 'get_author_bio');

    <img src='<?php echo get_avatar(get_the_author_meta('user_email'), 96); ?>'/> doesn't display the thumb, other than everything is alright.
    Do you know how to get the avatar using this function?

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic