Skip to:
Content
Pages
Categories
Search
Top
Bottom

Turn avatar into link to profile in an author box


  • 3rdaxis
    Participant

    @3rdaxis

    I would like to turn this line of code

    <?php echo get_avatar( get_the_author_meta( 'user_email' ), 68 ); ?>

    Into clickable avatar that would lead to an authors profile page.

    I have tried to look this up, but any results on trying to make this work lead to page errors or linking back to the current post the author box is on.

    Any help would be appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)

  • Henry
    Member

    @henrywright-1

    Just wrap a <a href...> around that statement. That will turn the avatar into a link.


    3rdaxis
    Participant

    @3rdaxis

    I have already tried that. Its turns into a link, but that does not make it go to the authors profile page.

    Im not trying to make it go to a specific profile. When it is clicked i need it to go to profile belonging to the the persons avatar.


    Henry
    Member

    @henrywright-1

    
    <a href="/members/<?php echo bp_core_get_username( get_the_author_meta( 'ID' ) ); ?>/">
    // put your avatar here
    </a>
    

    3rdaxis
    Participant

    @3rdaxis

    Thank you very much for your help.. that worked perfect.


    Henry
    Member

    @henrywright-1

    @3rdaxis just to note that’ll work on that page only. If you want to link an avatar that’s on a member’s profile page or in the members loop for example you’ll need to use a slightly different way of getting the user’s ID.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Turn avatar into link to profile in an author box’ is closed to new replies.
Skip to toolbar