• I’d like to add both the author’s name and avatar into a post in such a way that it would also appear in the Atom feed.

    Currently we have about 17 sites and we posts newsletters in one place, then use the Atom rss feed to distribute and repost them on the other 16 sites. But when I do this, the byline is gone and it is posted as “admin” or another user.

    When I use functions like:
    <?php echo get_avatar( $id_or_email, $size, $default, $alt ); ?>

    in the single post loop, I get the avatar on the main site, but on the other 16 sites it doesn’t get distributed. Same for the by line.

    Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jrwells42

    (@jrwells42)

    Ok… getting there. This puts the stuff at the bottom, and it copies over to the other 16 sites, however it then displays “admin” as the author and his bio/avatar.

    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 width='80' height='80' class='avatar' src='https://www.gravatar.com/avatar.php?gravatar_id=".md5(get_the_author_email()). "&default=".urlencode($GLOBALS['defaultgravatar'])."&size=80&r=PG' alt='PG'/>\n";
        $html.="<div class='author_text'>\n";
        $html.="<h4>Author: <span>".$post_author_name."</span></h4>\n";
        $html.= $post_author_description."\n";
        $html.="</div>\n";
        $html.="<div class='clear'></div>\n";
        $content .= $html;
    
        return $content;
    }
    
    add_filter('the_content', 'get_author_bio');

    Source: https://www.wprecipes.com/wordpress-hack-automatically-insert-author-bio-on-each-post

    Is there a way I can get this to keep the original author? Somehow have it transmit as text and not as php functions?

    Thread Starter jrwells42

    (@jrwells42)

    Errr, nevermind, the above code does work perfectly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding name and avatar into post & atom feed’ is closed to new replies.