加载CSS WordPress主题

我正在尝试为WordPress主题加载CSS, 但是似乎没有加载。

这是我到目前为止的

文件结构
造型
WP错误

我是建立WordPress主题的新手, 所以任何帮助都很棒。


#1


你的主要style.css文件必须位于根文件夹中。将style.css从css文件夹移动到根文件夹(与index.php相同的文件夹)。


#2


自定义主题需要两个文件

i)style.css ii)functions.php

你可以使用hooks从functions.php调用样式表:

function wpdocs_theme_name_scripts() {
    wp_enqueue_style( 'style-name', get_stylesheet_uri().'yourstylesheetname.css' );
    wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );

来源:

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