You may use:
echo get_bloginfo('template_url') . 'images/imagename.png';
Or
<img src="<?php bloginfo('template_url'); ?>/images/img.png" />
bloginfo, get bloginfo. Also, read this article.
题
This seems to have been asked around, but with different answers.
I've the image folder "images" in the same directory as the page.php file which I want to add images to. Yet the path "images/foldername/image.gif" doesn't yield any images on the page. Whereas from a non-wordpress html file that path would work, so what is the answer to this? What makes wordpress not understand file paths, assuming I'm not missing something?
also tried /images with the slash just in case.
没有正确的解决方案
其他提示
You may use:
echo get_bloginfo('template_url') . 'images/imagename.png';
Or
<img src="<?php bloginfo('template_url'); ?>/images/img.png" />
bloginfo, get bloginfo. Also, read this article.
You mean inside the WordPress themes folder? If so, correct path is http://www.domain.com/subdirectory/wp-content/themes/yourtheme_name/images
You can use <?php get_template_directory_uri(); ?>/images/foldername/image.gif