我尝试将html模板转换为wordpress。我尝试从二十十九=>
创建一个儿童主题/*
Theme Name: Twenty Nineteen Child - Cigolo
Theme URI: http://inanccagiran.local/wp-content/themes/cigolo
Version: 1.0.0
Template: Twenty Nineteen
Text Domain: cigolo
*/
然后我尝试在functions.php中获取css文件=>
function my_theme_enqueue_styles() {
$parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
$child_style = 'child-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style )
);
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function new_theme_enqueue_styles() {
wp_enqueue_style( 'twentynineteen-style', 'netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css');
wp_enqueue_style( 'bootstrap-css', get_stylesheet_directory_uri() . '/css/plugins/bootstrap.min.css', array(), null, 'all' );
}
add_action( 'wp_enqueue_scripts', 'new_theme_enqueue_styles' );
现在,尽管开发人员工具的“网络”标签中的路径似乎正确,但我得到了404
的{{1}}。
你能帮我吗?
答案 0 :(得分:-1)
get_template_directory_uri();
返回主主题文件夹,供子主题文件夹使用
get_stylesheet_directory_uri();