子CSS的函数theme_enqueue_styles()

我的孩子主题文件夹由文件’style.css’和’functions.php’组成, 在我的functions.php文件中, 我无法访问函数theme_enqueue_styles()来使用自定义的CSS

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() .'/style.css' );
}

#1


对于子主题, 你需要将get_template_directory_uri()替换为get_stylesheet_directory_uri()。

该代码应为:。

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
  wp_enqueue_style( 'parent-style', get_stylesheet_directory_uri() .'/style.css' );
}

来源:

https://www.srcmini02.com/66493.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_40456.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?