I've been working through Chris's tutorials on Wordpress, as you'll see from the site http://www.whatkindareyou.com, but I can't get the img tag to work. In the beginning, I thought it might be the fact that it was an anchor link, but that doesn't seem to be the case either.
I know it sounds like a complete noob question, and I'll live with that mantle but I just need other eyes looking at it.
<img src="/images/benefit_banner.png">
That should be the left side bar image. I know that the link should be right, because I can get the image to show up as a background image css, but I can't get the images to show from the html side.
Whaleo, thanks for the response. I had an alt tag, but it was the only thing showing up. I've put it back in, as you can see... still the only thing you can see.
I don't know a whole lot about doctype. Shouldn't that have been covered by wordpress?
I agree with box. When you go to view the image in FF you get a 404 error indicating it can't be found. You most likely FTP'd the image with a different name. Either that, or take out the opening forward slash in your relative url. ie the url would be "images/benefit_banner.png".
I saw that too, I've been playing with this for days.
Here's the thing. I tried to remove the slash, no go, but here's the other thing. If you check the site again, the image is there. It's set as a background image though in css.
The idea is that the ../ stands for levels in your file structure. where the first ../ could mean your domain.com/images/
so if your file is in the images folder in a named folder that is inside a theme folder then you would need ../../../ that's three levels. The only other thing you can do is a direct path to the image. <img src="http://www.your_domain.com/themes/your theme/images/image name here" alt="some description" />
Thanks, cybershot. That did it. It turns out that I have multiple domains hosted on this server. I didn't realize that, when I signed up, it would cause that type of confusion otherwise, I'd have made this site the main one.
Take care guys. Thanks so much for all the suggestions.
If this is an image you want shown in your Wordpress theme you can easily have it should but you need to have a direct path to it if your storing it in your themes images folder. So your img url would be:
What this does with the PHP bit for Wordpress is automagically link to your Wordpress theme directory, and then it will be directed to the right image.
So there lies your problem ;) You were linking to a file in a folder that didn't exist off your main root. Since it lives in the images folder of your theme (which is why it showed up in the CSS images/image.png is in the same directory as your CSS file so no direct path needed) you need to link directly to that image in your root. The Wordpress bloginfo tag makes it easy to link to that directory without having to type http://yoururl.com/wp-content/themes/yo ... /image.gif.
I know it sounds like a complete noob question, and I'll live with that mantle but I just need other eyes looking at it.
That should be the left side bar image. I know that the link should be right, because I can get the image to show up as a background image css, but I can't get the images to show from the html side.
Thanks in advance everyone.
I'm not sure what it could be but it should have a closing backslash '\' and an alt property:
Depends on your DOCTYPE but this might be the cause.
Let me know what you come up with!
Whaleo :)
I don't know a whole lot about doctype. Shouldn't that have been covered by wordpress?
Here's the thing. I tried to remove the slash, no go, but here's the other thing. If you check the site again, the image is there. It's set as a background image though in css.
code is this:
Doesn't that mean it has to be in the right place?
<img src="../images/your image_name_here" alt="a description" />
if that doesn't work add another ../ to your path like this
<img src="../../images/your_image_here" alt="a description" />
if that doesn't work, do it again
<img src="../../../images/your_image_here" alt="a description" />
The idea is that the ../ stands for levels in your file structure. where the first ../ could mean your domain.com/images/
so if your file is in the images folder in a named folder that is inside a theme folder then you would need ../../../ that's three levels. The only other thing you can do is a direct path to the image. <img src="http://www.your_domain.com/themes/your theme/images/image name here" alt="some description" />
Take care guys. Thanks so much for all the suggestions.
<img src=\"<?php bloginfo('template_directory); ?>/images/benefit_banner.png\">What this does with the PHP bit for Wordpress is automagically link to your Wordpress theme directory, and then it will be directed to the right image.
So there lies your problem ;) You were linking to a file in a folder that didn't exist off your main root. Since it lives in the images folder of your theme (which is why it showed up in the CSS images/image.png is in the same directory as your CSS file so no direct path needed) you need to link directly to that image in your root. The Wordpress bloginfo tag makes it easy to link to that directory without having to type http://yoururl.com/wp-content/themes/yo ... /image.gif.
:)