how to display avatar with website link (2 posts)

  1. posthawk
    Posted 3 years ago #

    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

  2. posthawk
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic