Support » Fixing WordPress » Adding an author picture

  • Resolved neildubya

    (@neildubya)


    Hi

    I’m trying to get author pictures to appear next to posts using the method described in the WordPress 2 Visual Quickstart Guide book; that is, placing the following code in my theme’s index.php file

    <img src="<?php get_bloginfo('url'); ?>wp-content/images/authors/<?php the_author_ID();?>.jpg" class="auth" alt="<?php the_author(); ?>. " title="<?php the_author(); ?> "/>

    I’ve created a directory at wp-content/images/authors and uploaded a picture which is named the same as my author ID but the picture is not appearing. Assuming the code is correct (I don’t know enough PHP to say for sure) then I guess it must be either a problem with my path or maybe permissions? Or is there something else I haven’t thought of?

    Any help appreciated – many thanks.

    Neil

Viewing 13 replies - 1 through 13 (of 13 total)
  • I think you are just missing one little thing:
    Right before wp-content, you want a “/” without the quotes.

    If that doesn’t work could you like to it not working?

    Thanks Mark – I thought perhaps that php get_bloginfo('url') would give myblogurl.net/ but maybe it just gives myblogurl.net, in which case the extra “/” should make all the difference. Will try it later to see if it works.

    Not sure what you mean by “could you like to it not working”…?

    Neil

    sorry, it’s late. I meant “link” not like.

    Me again. Unfortunately the extra “/” hasn’t made any difference. Looking at the source of my front page it looks like get_bloginfo() doesn’t seem to be doing much as the image source is not the proper path. The URL of my blog is http://fifteensquared.net.

    Once again, any help much appreciated.

    Neil

    Just a quick thought; I’ve assumed that it shouldn’t make any difference which theme I’m using. Is that correct?

    cheers

    Neil

    So long as you’ve input the code you’ve specified above in the theme that you’re using, then it (theoretically) shouldn’t matter.

    That’s what I thought. Either way, I can’t get that code to work though.

    Okay. Have you tried:

    <img src="<?php get_bloginfo('home'); ?>/wp-content/images/authors/<?php the_author_ID();?>

    Also, are you sure that your image is named correct? Can you access the image directly at the URL via a browser?

    I am a fool. It was a permissions problem – DianeV got it right: I couldn’t access the image from a browser.

    Thanks for your help everyone.

    Neil

    > I am a fool. It was a permissions problem

    Well, why should you be different? 🙂

    We’ve all, I’m sure, made loads of mistakes along the way.

    I have tried the follwoing based on this post.

    <img width=”135″ height=”180″ src=”<?php get_bloginfo(‘home’); ?>/wp-content/uploads/authors<?php the_author_ID();?>

    I get a blank box on the author.php page,

    I can get the photos by palceing the link in a web page. I used this link and get the photo:
    http://monarchhousing.org/wordpress/wp-content/uploads/authors/24.JPG

    What am i doing wrong?

    I had a heck of a lot more luck with the following:

    <img src="<?php bloginfo('template_directory'); ?>/images/authors/<?php the_author_ID();?>.jpg" class="auth" alt="<?php the_author(); ?>. " title="<?php the_author(); ?> "/>

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Adding an author picture’ is closed to new replies.