Author Post Link (3 posts)

  1. Erik
    Posted 6 years ago #

    I've got a section on a theme were I've called the author's gravatar to show up as a picture that accompanies their post. I want to make to if a visitor clicks on that gravatar it would take them to the author's page with their information and past posts.

    So the code that calls the gravatar is:
    <?php echo get_avatar( get_the_author_email(), '70' ); ?>

    So I tried this just to see if it would work:
    a href=" <?php author_post_link();?>" <?php echo get_avatar( get_the_author_email(), '70' ); ?> /a

    And that didn't work. So is there a way I can put the author's link to their page and link it back to their gravatar picture?

  2. MAzCastro
    Posted 6 years ago #

    You have some minor incorrections in the code shown, but I guess they are caused by the copy-paste.

    That aught to work, what sort of error do you get?


  3. Erik
    Posted 6 years ago #

    For whatever reason the code wasn't showing up correctly, so I removed the <> brackets and it seem to show okay, so I know the code syntax is wrong.

    The the_author_post_link command creates it own link and anchor tags. So just the anchor tag looks like this: (simplify)

    <a href="<a href="/author/user">user</a>"><image></a>

    So I just want a way to dynamically creates the link to the author page so I can make the gravatar a clickable link.

Topic Closed

This topic has been closed to new replies.

About this Topic