WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: User Photo] Add link to author page from photo (3 posts)

  1. Michelle
    Member
    Posted 4 years ago #

    In case anyone is wondering, this is a bit of code which will allow you to link from the author photo to the author page. This only works within the Loop.

    <?php
    if (function_exists('userphoto_the_author_thumbnail')) {
        $author_id=$post->post_author;
        $curuser = get_userdata($author_id);
        $author_post_url=get_author_posts_url($curuser->ID, $curuser->nicename);
        echo '<div class="authorThumb">';
        echo '<a href="' . $author_post_url . '" title="' . sprintf( __( "View all posts by %s" ), $curuser->user_nicename ) . '" ' . '>';
        userphoto_the_author_thumbnail(); the_author_meta(user_url);}
        echo '</a></div>';
    ?>

    http://wordpress.org/extend/plugins/user-photo/

  2. williamatkin
    Member
    Posted 4 years ago #

    For anyone else using this fix, I needed to modify the code above to get my author thumbnail linked without any additional text. The code I used sucessfully thanks to mmcginnis

    <?php
    if (function_exists('userphoto_the_author_thumbnail')) {
        $author_id=$post->post_author;
        $curuser = get_userdata($author_id);
        $author_post_url=get_author_posts_url($curuser->ID, $curuser->nicename);
        echo '<div class="authorThumb">';
        echo '<a href="' . $author_post_url . '" title="' . sprintf( __( "View all posts by %s" ), $curuser->user_nicename ) . '" ' . '>';
        userphoto_the_author_thumbnail();}
        echo '</a></div>';
    ?>
  3. spacechampion
    Member
    Posted 4 years ago #

    I'm using the Member List plugin to create a directory of members. On the Author page I am trying to insert the userphoto_thumbnail with a link to the userphoto (with a thickbox class on the link to display it in the thickbox modal window).

    So how do I get the URL to the userphoto rather than outputting the img tag?

Topic Closed

This topic has been closed to new replies.

About this Topic