WordPress.org

Support

Support » How-To and Troubleshooting » how to display avatar with website link

how to display avatar with website link

  • i want to display a user avatar, which i can with this code-

    echo get_avatar( get_the_author_meta(‘ID’), 32 );

    but i want to make it clickable with the webite the user provided as the link and i cant seem to make it work, mainly i cant find the code to use.

    i found this, but im not sure if its right or how to combine them
    get_the_author_meta( ‘user_url’ )

    this will be in a sidebar by the way
    any advice would help

Viewing 1 replies (of 1 total)
  • this is what i have but i cant get the image to display

    <a href="<?php the_author_meta( 'user_url' ); ?>"><img class="aligncenter" title="<?php the_author_meta( 'display_name' ); ?>’s Website" alt="Author Webite Link" src="<?php echo get_avatar( get_the_author_meta('ID'), 32 ); ?>"> </a>

    it just gets a broken link and “> in hyperlink text on certain pages

    i know that get_avatar does work, there’s just something wrong in the code. everything else works fine, the link, the alignment, the title, everything but the image.

Viewing 1 replies (of 1 total)
  • The topic ‘how to display avatar with website link’ is closed to new replies.