WordPress file right there, cannot be found!
I have Wordpress deployed on Ubuntu server.
开发者_开发百科in the folder where my theme is I have index.php. In the same folder I have a file: "logo.png"
in index.php I have the following line:
<img src="logo.png" alt="" />
Yet, i get a broken image when browsing there. How can that be? The file is right there, sibling to index.php in the folder!
It's going to look for logo.png in the root directory of the website, not in your theme folder. You need to add the path to your theme directory to the image tag.
I got it, should have used:
<?php bloginfo('template_directory'); ?>
so that the right path is taken at runtime for my theme folder.
try something like this
<img src="<?php bloginfo( 'template_url' ); ?>/logo.png" alt=""/>
You can also specify the full path of the logo.png file in image source so that it will grab the logo image from the source rather then looking in your parent directory for the logo image
<img src="*Full path of logo.png file*" alt="" />
精彩评论