Wordpress – 为不同的页面加载不同的 CSS 不起作用

Wordpress – Loading different CSS for different page not working

我正在使用以下分支将不同的 css 样式应用到页面 (ID 130)。

function wipkip_scripts() {
  wp_enqueue_style( 'wipkip-style', get_stylesheet_uri() );

  if ( is_page(130) ) {
    wp_enqueue_style( 'wipkip-style-home', get_stylesheet_uri() . '/style-homepage.css' );
  }
}

问题是它会生成错误的 URL,我不确定为什么。这是它生成的URL:

http://myurl.com/wp/wp-content/themes/wipkip/style.css/style-homepage.css?ver=5.2.2

它以某种方式自动在已经存在的 style.css[=13= 之后添加 /style-homepage.css ]

有人知道解决这个问题的方法吗?

干杯

get_stylesheet_uri() - 检索当前主题样式表的 URI。

使用 get_stylesheet_directory_uri() 检索样式表目录 URI,然后附加样式-homepage.css.