WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] User Photo with Twenty Eleven (5 posts)

  1. Hal Medrano
    Member
    Posted 2 years ago #

    Sorry for the newbie question; I'm having a heck of a time trying to get user photos to appear beside an author's name in his/her byline.

    I installed the User Photo plugin, and am using Twenty Eleven with WP 3.3.1. I saw the documentation that says I have to do a bunch of PHP hand coding after installing the plugin. Um...okay, but which FILES do I add the php codes to so that author thumbnails appear beside their names?

    Thanks in advance,

    Hal

  2. aboelabbas
    Member
    Posted 2 years ago #

    I am using the plugin user-avatar I think it is better.

    and to make the avatars appear beside the names You can use the function
    get_avatar()

    In which files ? to display it beside by (name), you need to make a change in the post footer in the file (content-single.php) in the $utility_text values.

    ===========example:
    open content-single.php file of twentyeleven theme and find this text:
    %5$s
    replace it with:
    %7$s %5$s
    Then find, this part :

    printf(
    				$utility_text,
    				$categories_list,
    				$tag_list,
    				esc_url( get_permalink() ),
    				the_title_attribute( 'echo=0' ),
    				get_the_author(),
    				esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) )
    			);

    replace it with:

    printf(
    				$utility_text,
    				$categories_list,
    				$tag_list,
    				esc_url( get_permalink() ),
    				the_title_attribute( 'echo=0' ),
    				get_the_author(),
    				esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    				get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 20) )
    			);

    Note: this change in the $utility_text values may affect translation of this part of the theme if it isn't in English.

  3. Hal Medrano
    Member
    Posted 2 years ago #

    Thanks for the reply, Dawn; sorry it's taken a few days for me to get back on this project.

    I installed the plugin you suggested and made the code changes. No errors have cropped up, but the avatar is still not appearing on blog posts.

    Within the get_avatar ( get_author_meta ( 'user_email')... function, I tried swapping the 'user_email' argument with 'ID', and it made no difference – I thought the function might just not be finding the author's meta-data.

    I do like the intuitive way the plugin allows me to add an author photo. I'm just not able to get this image to print to screen on posts.

    Thanks again for your help.

  4. Hal Medrano
    Member
    Posted 2 years ago #

    Please disregard previous; the user photo DOES appear beside the author's name BELOW the article. I just need to find the place at the TOP of the article to add the get_avatar function.

    Thank you again for all your help!

  5. PrestoK
    Member
    Posted 2 years ago #

    I was having the same issue as the OP, not knowing which files I had to edit. This was the closest I got to an answer that would solve my newbie problem, however it didn't work.

    I did the exact same thing as Dawn suggested - same plugin, same modifications on the same page.

    blog at http://honestaciadeteatro.com.br/wp (not in english, sorry)

Topic Closed

This topic has been closed to new replies.

About this Topic