Why is it that this: <?php bloginfo('template_directory'); ?>, will work for things like stylesheets, but I can't make it work for an image?
<img src="<?php bloginfo('template_directory'); ?>/images/blah.jpg">
Why is it that this: <?php bloginfo('template_directory'); ?>, will work for things like stylesheets, but I can't make it work for an image?
<img src="<?php bloginfo('template_directory'); ?>/images/blah.jpg">
--------------------------------------------------Reviews, Interviews, Tutorials, and STUFF--------------------------------------------------Home of the SexyBookmarks WordPress plugin
did you rename your /images/ directory after installing wordpress? the default directory is /img/, not /images/. that may be your problem.
- Josh
no, the directory for images inside my theme directory is "images" not "img"
--------------------------------------------------Reviews, Interviews, Tutorials, and STUFF--------------------------------------------------Home of the SexyBookmarks WordPress plugin
I'm not sure how to answer your specific wordpress question but if you can't figure it out, in your template where you are trying to use images you might be able to hardcode it with something like the following...
That can be added to the top of your page so if your path ever changes you only have to change it once in your page. You could also in theory place just that in a page named "wp_temp_path.php" or something similar. If you are working with other pages you could include that path page to use it in the same way across many pages.PHP Code:<?php $TEMPLATE_PATH = $_SERVER[DOCUMENT_ROOT] . '/wp-content/themes/YOUR_THEME/images/'; ?>
Where you want to place an image, you should be able to do something like this...
That way if you know your image is in the images folder, you can just add it like above and php should do the rest for you.PHP Code:<img src="<?php echo "{$TEMPLATE_PATH}blah.jpg"; ?>">
I can understand that wordpress is what you are working with so you would like to figure it out, but if no one else has any suggestions the above might work for what you are trying to do. Hope that helps.
After you do that, view the source and look at the output. Does it link to the correct image path?
Bookmarks