2011-08-03 58 views
3

我建立一个自定义的版面图WordPress的theme.So我有我的主题文件夹下的文件/文件夹:定制的wordpress主题:不显示

header.php 
index.php 
footer.php 
style.css 
/images 
picture-1.jpg 

我的问题是,我无法正确显示使用IMG标签图像要么在index.php中,的header.php和footer.php:

[..] 
<div class="module"> 
<h4>General info</h4> 
<img src="images/picture-1.jpg"/> 
[..] 

enter image description here

林年龄是存在的,并且如果被style.css引用,则显示正确:

.banner{ 
    background-image:url(images/picture-1.jpg); 
} 

我想念什么吗?

感谢 卢卡

回答

10

这是因为你的文件不在/images相对于你正在浏览的网页,他们在wp-content/themes/[yourthemename]/images

你可以避开这个由base URL设置到您的网站在您的网站的头部分的根和链接的图像如上图所示,或者通过使用这样的事情:

<img src="<?php bloginfo('template_directory'); ?>/images/picture-1.jpg" alt="alt text" />

0

尝试这个:

<img src="<?php echo get_template_directory_uri();?>/images/img-9.png"/> 
相关问题