我在自己的电脑上安装了wordpress。 thr主题的路径是 C:\ Program Files \ Zend \ Apache2 \ htdocs \ www \ www1 \ wordpress \ Building_Child_Themes \ wp-content \ themes \ BLANK-Theme \ home.php
文件夹 BLANK-Theme 内有文件夹cald 图片,如 wordpress \ Building_Child_Themes \ wp-content \ themes \ BLANK-Theme \ images
在文件home.php
内我有<img src="/images/prod-sprunkler.png" alt="Image of Super Sprocket 1000" />
行
上传home.php
时我无法查看法师,在地址栏中我看到 http://127.0.0.1/www/www1/wordpress/Building_Child_Themes/
非常感谢。
答案 0 :(得分:0)
您必须使用完整路径。您可以获取默认函数的帮助以获得完整路径。
如果wordpress站点的style.css文件位于同一目录中,则可以使用以下命令。
<img src="<?php get_stylesheet_directory() ?>/images/prod-sprunkler.png" alt="Image of Super Sprocket 1000" />