我正在尝试为WordPress主题加载CSS, 但是似乎没有加载。
这是我到目前为止的



我是建立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