在我的孩子主题中,我有:
add_action( \'wp_enqueue_scripts\', \'theme_enqueue_styles\' );
function theme_enqueue_styles() {
wp_enqueue_style( \'parent-style\', get_template_directory_uri() . \'/style.css\' );
//Load Bootstrap and 3rd Party
wp_enqueue_style( \'bootstrap\', \'//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css\' );
wp_enqueue_style( \'fontawesome\', \'//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\' );
wp_enqueue_style( \'select2css\', \'//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css\' );
// Load our main stylesheet.
wp_enqueue_style( \'less-style\', \'/css/style.less\' );
}
顶部的所有外部样式表都正确加载,但较少的样式表会导致500个错误。
我唯一一次这样做是在非儿童主题中,我有:
function themename_scripts() {
// Add custom fonts, used in the main stylesheet.
wp_enqueue_style( \'themename-fonts\', themename_fonts_url(), array(), null );
// Add Genericons, used in the main stylesheet.
wp_enqueue_style( \'genericons\', get_template_directory_uri() . \'/genericons/genericons.css\', array(), \'3.2\' );
//Load Bootstrap and 3rd Party
wp_enqueue_style( \'themename-bootstrap\', \'//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css\', array( \'themename-style\' ), \'20141010\' );
wp_enqueue_style( \'themename-fontawesome\', \'//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\', array( \'themename-style\' ), \'20141010\' );
wp_enqueue_style( \'themename-select2\', \'//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css\', array( \'themename-style\' ), \'20141010\' );
// Load our main stylesheet.
wp_enqueue_style( \'themename-style\', get_stylesheet_uri() );
wp_enqueue_style( \'less-style\', get_template_directory_uri() . \'/css/style.less\' );
}
add_action( \'wp_enqueue_scripts\', \'themename_scripts\' );
当这不是儿童主题时,效果很好。我在顶部的儿童主题中遗漏了什么?