WordPress –为不同页面加载不同的CSS无法正常工作

我正在使用以下fork将不同的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之后自动添加/style-homepage.css

有人知道解决办法吗?

干杯


#1


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

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

来源:

https://www.srcmini02.com/64387.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_41402.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?