- This topic is empty.
-
AuthorPosts
-
October 26, 2008 at 5:19 pm #23474Digital SkrapsMember
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?
October 26, 2008 at 5:40 pm #50715mikesMemberI 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.
October 26, 2008 at 6:06 pm #50540Digital SkrapsMemberahhhh 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.
October 27, 2008 at 12:50 am #50738Digital SkrapsMember*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.
October 27, 2008 at 2:45 pm #50749mikesMemberI 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!
October 27, 2008 at 8:25 pm #50755mikesMemberWoot! 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!
November 28, 2008 at 11:06 am #51548SugarBlushMemberEDITED
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 useCode:url(images/comment_bubble.gif)it shows but when I try to use
Code:it just won’t work. ANy idea?
March 31, 2013 at 3:17 pm #130285ray_acostaMemberHi guys!
I got stucked! I´m using a child theme and the:
March 31, 2013 at 3:18 pm #130287ray_acostaMemberThe following code: _images/demos/demo03.jpg” /> It just did´t work until i puted images in the parent directory. Any thoughts?
March 31, 2013 at 3:22 pm #130286Paulie_DMemberPlease start a new thread instead of bumping a 5 year old one.
-
AuthorPosts
- The topic ‘WordPress wont show images’ is closed to new replies.