WordPress.org

Support

Support » Themes and Templates » alt text showing but not image

alt text showing but not image

  • caffeineoverload
    Member

    @caffeineoverload

    Hi –

    I am trying to show a DIV only on the home page. Right now I am trying to add an image to the DIV. It shows text just fine. I am using the following code but only the alt text shows up no image.

    <!–my static header experiment 08_07_08 –>
    <?php if (is_home())
    echo ‘<div id=”mystatic”>
    <img src=”images/siteimages/static1.jpg” alt=”horses collage 1″ />
    </div>’;
    ?>

    I am just learning all of this so I am open to suggestions.

    Thank You,
    CO

Viewing 4 replies - 1 through 4 (of 4 total)
  • caffeineoverload
    Member

    @caffeineoverload

    BTW I also tried:

    <div id=”mystatic”>
    <?php if (is_home()) echo ‘<img src=”images/siteimages/static1.jpg” alt=”horses collage 1″ /> ‘; ?>
    </div>

    Thank Again,
    CO

    poodlerat
    Member

    @poodlerat

    It sounds like your browser can’t find the images you want it to show. Try using absolute rather than relative links. Instead of:

    <img src="images/siteimages/static1.jpg">

    use something like:

    <img src="http://yoursite.com/images/siteimages/static.jpg">

    Avoid relative links in your templates except in your stylesheets.

    caffeineoverload
    Member

    @caffeineoverload

    Thanks,

    the absolute links was the solution

    CO

    poodlerat
    Member

    @poodlerat

    Glad I could help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘alt text showing but not image’ is closed to new replies.