Forums

adding a photo to blog posts unique to each author (2 posts)

  1. wp.rook
    Member
    Posted 2 years ago #

    What I'm trying to do is display the author name with a photo of the author next to their respective blog entries.

    The following code is in the loop. I'm pretty green with PHP, so I may not be approaching this from the best angle. I have bolded the code that I wrote (the rest if from the wordpress support documentation).

    <?php
    if(get_query_var('author_name')) :
        $curauth = get_userdatabylogin(get_query_var('author_name'));
    else :
        $curauth = get_userdata(get_query_var('author'));
    endif;
    if($curauth=="chimpact")
    {
    echo "<img src=\"images/cheryl-125x125.jpg\">";
    }
    ?>
    	<p>Written by:
    <?php the_author_posts_link(); ?></p>
  2. wp.rook
    Member
    Posted 2 years ago #


Topic Closed

This topic has been closed to new replies.

About this Topic