Forums

[resolved] Noob Q : Why wont wordpress php files display images? (5 posts)

  1. tylerjay
    Member
    Posted 2 years ago #

    I'm a building my theme's homepage. I have images/graphics within the php like this "<img src="img/featuredcalendar.jpg" width="280" height="33" />"
    however they won't display. Background images are loading fine.

    Is there a reason for this? Is the only way around to use background images?

  2. motivatebusiness
    Member
    Posted 2 years ago #

    You need to call the images using: <img src="<?php bloginfo(stylesheet_directory); ?>/img/featuredcalendar.jpg" width="280" height="33" /> -

  3. nathanrice
    Member
    Posted 2 years ago #

    probably because your img src is in a "relative path" format, meaning it is looking for images in the img folder, relative to the path you are currently browsing.

    Try doing this:

    <img src="<?php echo bloginfo('stylesheet_directory'); ?>/img/featuredcalendar.jpg" width="280" height="33" />
  4. tylerjay
    Member
    Posted 2 years ago #

    That did it. Thank you sir!

  5. helenspacegirl
    Member
    Posted 2 years ago #

    good tip, have to remember this

Topic Closed

This topic has been closed to new replies.

About this Topic