Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other WordPress wont show images

  • This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #23474

    I have to put some images inside the header.php file and none of them are showing up. really confused as to why this is happening. theyre in the images folder and the css images are showing up with the same file path but not the in document images.
    im using the starkers template base.

    any ideas?

    #50715
    mikes
    Member

    I ran into the same thing. In my stylesheet, I can use url(‘images/logo.gif’) and it displays just fine. However, on any of the pages, if I use <img src="images/logo.gif" /> it won’t display.

    The reason is that, in the latter case, WP is looking for the image in it’s main directory. If you specify the entire path it will work:

    <img src="/wp-content/themes/your_theme/images/logo.gif" />

    Alternately, you could define a variable with the path.

    Put <?php define(‘IMGPATH’, ‘/wp-content/themes/your_theme/images/’); ?> in your header file and then reference images like this:

    <img src="<?php echo IMGPATH; ?>logo.gif" />

    There is probably a better way but I’m new to WP as well and this is the best I’ve found so far.

    #50540

    ahhhh thats bizarre to me.
    i dont really understand why, if these files including my css live in the theme directory, why it would look outside of that for images. unless it has something to do with the wordpress upload mechanism but that doesnt really make sense either since im physically putting these here.

    it did work though.

    i think i had this problem before on another blog but i ended up using CSS ultimately. for this i need them in the document.

    thanks for the help!!! saved me at minimum an hour of screwing around probably.

    #50738

    *Update:

    After the full path fixed the issue when i was on the index page, once i set up subpages and started trying to navigate to them, those same images we’rent showing up by my css backgrounds were. all these images are in the header file. i added "../" before those file paths and theyre now working in sub pages which is also very strange to me, so far it doesnt appear to break the index page so looks like this might be the fix for it. we’ll see.

    #50749
    mikes
    Member

    I like that much better. It’s cleaner. I’m still pretty new to WP so I didn’t know about bloginfo(‘template_directory’) yet. Thanks!

    #50755
    mikes
    Member

    Woot! Goldmine!

    That’s exactly what I needed. I’ve been meaning to look at their site for a while but hadn’t gotten to it yet. Glad to see they have good info there.

    Thanks!

    #51548
    SugarBlush
    Member

    EDITED
    I was wrong. It didn’t work for me. I tried 3 of the methods above and it didn’t work. What could be the problem?
    The problem is, when I use

    Code:
    url(images/comment_bubble.gif)

    it shows but when I try to use

    Code:

    it just won’t work. ANy idea?

    #130285
    ray_acosta
    Member

    Hi guys!

    I got stucked! I´m using a child theme and the:

    #130287
    ray_acosta
    Member

    The following code: _images/demos/demo03.jpg” /> It just did´t work until i puted images in the parent directory. Any thoughts?

    #130286
    Paulie_D
    Member

    @ray_acosta

    Please start a new thread instead of bumping a 5 year old one.

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘WordPress wont show images’ is closed to new replies.