我使用的是Genesis,我有一个函数.php,我用钩子在页脚插入了图像。
我使用了一个小部件在页眉中插入一个图像。
当在主页中查看时,图像会正确显示,但当我切换页面时,图像不会显示。
进一步的调查得出结论,wordpress正在寻找路径来源错误的文件。
这是主页中的路径源-wp-content''themes''childTheme Almog''images''linkedin.png
wordpress正在寻找它应该有的样子。
然而,在另一个名为"X"的页面上,wordpress正在寻找如下相同的图像:''wordpress''x''wp content''themes''childTheme Almog''images''linkedin.png
正如你所知,它将页面名称作为文件夹添加到路径中,这是不应该做的,因为图像不在那里。
有没有办法让wordpress像在主页上一样查找图像?
以下是如何在我的函数中实现我的图像。hp:
<div class="d_footer">
<ul id="list_left">
<li class="foot" id="ft_text1"><img src="wp-content'themes'childTheme-Almog'images'phone.png" alt="phone">
<span style="color: #969697">|</span><span style="margin-left:30px;"></span><img src="wp-content'themes'childTheme-Almog'images'envelope.png" alt="envelope"></li>
<li class="foot" id="ft_text2"></li>
</ul>
<ul class="foot" id="list_right">
<li id="ft_text3"><img src="'wp-content'themes'childTheme-Almog'images'linkedin.png" alt="linkedin" align="left">Almog's linkedin profile</li>
<li id="ft_text4"></li>
</ul>
</div>
您确实应该使用Wordpress的get_stylesheet_directory_uri变量来缓解类似路径的问题。