【问题标题】:Images not loading in my wordpress theme图片未加载到我的 wordpress 主题中
【发布时间】:2014-06-03 02:48:15
【问题描述】:

我制作了一个网站的 html / css 模型,并希望将该静态网站集成到 wordpress 中。但是,图像没有出现,我将图像的路径作为 url localhost/wordpress/logo.png

我正在本地主机上开发它,所以主题在localhost/wordpress/wp-content/themes/mytheme 以及localhost/wordpress/wp-content/themes/mytheme/images/上的图片。

我听说每张图片都必须使用一些 php 代码。有人可以帮我吗?

【问题讨论】:

  • 你的问题中没有任何代码,很难确定问题。
  • 如果你的图片的 url 是localhost/wordpress/logo.png 为什么你会期望在localhost/wordpress/wp-content/themes/mythemes/images 中找到它?此外,图片不应该放在 wordpress 中,它们放在 ../wordpress/wp-content/uploads
  • 你如何/在哪里插入图片?

标签: wordpress image


【解决方案1】:

对于你需要的东西,你必须使用这样的东西:

<?php echo get_template_directory_uri() . '/images/logo.png; ?>

;)

【讨论】:

  • 它不会让我建议编辑,因为它是
猜你喜欢
  • 1970-01-01
  • 2016-08-09
  • 2015-05-16
  • 2020-09-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多