Support » Fixing WordPress » images don’t show in browser

  • Resolved eagerbob



    searched the forums and found a lot of topics, but none seem related to my case.

    I am trying to get to build my first theme in WordPress.

    What I did was create a new theme and uploaded a index.php, a style.css and an images folder into this folder.I pasted my HTML into the index.php file and am in the process of changing this to a working theme. I changed the image URL’s using the bloginfo template tag like so:
    code <img src=”<?php bloginfo(‘template_directory’); ?>/images/
    sample.jpg” alt=”Example Image!” /> /code

    I I open my page in Firefox, The images do not show. I only see the alt tag, In Safari I get to see questionmarks.

    When I look into the sourcecode I see that the Image URL;s are allright. If I copy them and paste them in a browser the image shows as it should.

    The WordPress installation is a fresh install, latest version. No plugins except for Akismet.

    The site is here:

    What is happening here ?

Viewing 6 replies - 1 through 6 (of 6 total)
  • I’m not totally following you, and I’m not sure if the code you showed is interchangeable with this, but the template tag I use looks like this, slightly different from yours…..

    <?php bloginfo('template_url'); ?>/images/image.jpg

    or…(again….not sure here), but simple errors on a webpage can cascade and make webpages act real flaky

    I tried your template tag and the result is the same.

    Yes the page gives a lot off errors on validating but these are caused by the template tags I added,not the HTML

    Good idea to validate, a lot of those errors seem to be caused by the double quotes in the WordPress tags I added. If I change these to single quotes the errors disappear.

    This solves the image issue too:

    this works:
    <img src='<?php bloginfo(“template_directory”); ?>/images/sample_blog.jpg’ alt=”New Blog”/>

    this does not work:
    <img src=”<?php bloginfo(“template_directory”); ?>/images/sample_blog.jpg” alt=”New Blog”/>

    Still I am not getting it. Something like this:
    <img src=”images/ribbon_featuredblog.png” class=”ribbon” alt=”Featured Project”/> seems proper markup to me ?

    Or do you have to change the ” into ‘ if you change the image URL to a template tag ?

    umm….I always use the single quotes, but I guess I’m not the guy to ask. It’s what I always see, so I copy it

    My guess is that its something to do with PHP versus XHTML markup?
    (single or double quotes will validate xhtml strict….so thats my reasoning…)

    umm….I always use the single quotes, but I guess I’m not the guy to ask. It’s what I always see, so I copy it

    Well, I have never used other than double-quotes, but this is my first WP experiment so I might need to change that habit. Strange thing is that I am following a tutorial “how to be a rockstar WordPress designer” so you would suppose that the code inside was allright…

    Anyway, thanks for helping me in the right direction.

    Maybe someone else can shine her or his light on this issue ?

    Found the reason why my images did not show:

    if you use: `code <img src=”<?php bloginfo(‘template_directory’); ?>/images/
    sample.jpg” alt=”Example Image!” /> /codein a child theme your image will not be found. Reason is that(‘template_directory’)` points to the directory of your parent theme, not your child theme.

    So, using code (‘theme_directory’); /code instead solves this problem.

    hope this helps other people having the same issue.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘images don’t show in browser’ is closed to new replies.