【问题标题】:I am enqueuing stylesheet main while my images are not showing我正在排队样式表主,而我的图像没有显示
【发布时间】:2019-12-16 17:02:26
【问题描述】:

我正在将 HTML 转换为 Wordpress 主题。我正在排队样式表。但有些图像没有显示。 也许它可能是子文件夹问题

【问题讨论】:

  • 欢迎来到堆栈溢出,您可能想提供一些代码 sn-ps 让我们更好地了解您正在尝试做什么。

标签: html wordpress subdirectory enqueue


【解决方案1】:

这几乎肯定是一个路径问题——由于无法查看您的任何文件结构或代码,我怀疑 get_template_directory_uri() 是缺失的部分。这是您需要执行的操作的简化示例。

function itc_wp_enqueue_scripts() {
    wp_enqueue_style('bootstrap-style', get_template_directory_uri() . '/css/bootstrap.min.css');
}

add_action('wp_enqueue_scripts', 'itc_wp_enqueue_scripts');

您应该将 itc_ 替换为您自己的函数名称前缀。

【讨论】:

  • 我喜欢你的回答,但我面临的唯一问题是排队时丢失图像。是加载图像的任何特定方式
猜你喜欢
  • 1970-01-01
  • 2019-01-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-02-11
相关资源
最近更新 更多