ThemeShaper Forums » Thematic

Customizing Author info

(7 posts)
  • Started 14 years ago by ableparris
  • Latest reply from webdevTy
  • This topic is resolved

Tags:

  1. I'd like to add an avatar and some styling to the author bio that appears at the bottom of the post. Is there a way to do this thru the functions.php file?

    (I'm working on a child theme for a site with multiple authors)

    Posted 14 years ago #
  2. Hey Able,

    you can do this by creating a filter in your functions.php .. will this be a complete rewrite of the post footer or do you want to keep parts of it? Need more details.

    Cheers,

    Chris

    Posted 14 years ago #
  3. Hi Chris,

    I don't <i>think</i> it'd be a complete rewrite. All a really need is a way to add a photo to the author bio, but it's not accepting the image HTML.

    I'm thinking I'll have to do it another way. I'm open to suggestions.

    Sorry if that's not a helpful answer. :-/

    UPDATE:
    I just need a simple author bio like this one:
    http://www.alistapart.com/articles/indefenseofeyecandy

    Posted 14 years ago #
  4. Looks like a nice addition for my Code Snippets Project :-)

    .. will be back with a solution tomorrow.

    Cheers,

    Chris

    Posted 14 years ago #
  5. Hey Able,

    as promised .. here's your solution .. I added a tiny bit of markup .. add everything to your child theme's functions.php and do a bit of styling:

    function childtheme_postfooter($content) {
    	// we want the author's bio only on a single post
    	if (is_single()) {
    		$content .= "\n";
    		$content .= "\t";
    		// the whole class containing everything
    		$content .= '<div class="author_info">' . "\n";
    		$content .= "\t" . "\t";
    		// the class containing the gravatar
    		$content .= '<div class="author_gravatar">' . "\n";
    		$content .= "\t" . "\t" . "\t";
    		$content .= str_replace( "class='avatar", "class='photo avatar", get_avatar(get_the_author_email()) ) . "\n";
    		$content .= "\t" . "\t";
    		$content .= '</div> <!-- #author_gravatar -->' . "\n";
    		$content .= "\t" . "\t";
    		// the class containing the author's name and bio
    		$content .= '<div class="author_bio">' . "\n";
    		$content .= "\t" . "\t" . "\t";
    		// we're getting the name
    		$content .= '<strong>' . get_the_author() . '</strong>' . "\n";
    		$content .= "\t" . "\t" . "\t";
    		// we're getting the bio
    		$content .= get_the_author_description() . "\n";
    		$content .= "\t" . "\t";
    		$content .= '</div> <!-- #author_bio -->' . "\n";
    		$content .= "\t";
    		$content .= '</div> <!-- #author_info -->' . "\n";
    	}
    	// we need to return the postfooter content anyway
    	return $content;
    }
    // add the filter function to the main function
    add_filter('thematic_postfooter', 'childtheme_postfooter');

    Tested and approved.

    This function will be published in my Code Snippets in a couple of days including some basic CSS styling.

    Cheers,

    Chris

    Posted 14 years ago #
  6. Thanks Chris. And thanks for the note on Twitter!

    Posted 14 years ago #
  7. webdevTy
    Member


    Posted 13 years ago #

RSS feed for this topic

Reply

You must log in to post.