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.
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.
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.
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.
This reply has been reported for inappropriate content.
you should check the wordpress website. There are a bunch of tags that you can use in wordpress to do a whole bunch of things. Like get the most popular article, most recent, last 10 and so on. I think they call them template tags.
The topic ‘WordPress wont show images’ is closed to new replies.