Please share the full wp_enqueue_style
calls that are in the parent theme and in the child theme.
Plugin Contributor
lkraav
(@lkraav)
I think using @import shows the theme authors are not very well versed in their business.
@ Weston Ruter …great plugin, btw 🙂
from child theme…
function mbsimplicity_scripts_styles() {
wp_enqueue_style( 'mbsimplicity-style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'mbsimplicity_scripts_styles' );
from parent theme…
-this is in the theme set-up function at the start of functions.php-
add_action( 'wp_enqueue_scripts', 'modularbase_scripts_styles' );
-this is further into the file-
if ( ! function_exists( 'modularbase_scripts_styles' ) ) ;
function modularbase_scripts_styles() {
wp_enqueue_style( 'modularbase-style', get_stylesheet_uri() );
}
endif;
======
@lkraav
from the WordPress Codex : Child Themes (http://codex.wordpress.org/Child_Themes)
The child theme’s stylesheet will overwrite the parent theme’s stylesheet, but chances are you want to include the parent theme's stylesheet. To do this, you need to start the stylesheet with the following line:
@import url("../twentythirteen/style.css");
@modularbase:
The problem is that you are registering the same script twice via get_stylesheet_uri()
.
Your child theme can continue to have:
function mbsimplicity_scripts_styles() {
wp_enqueue_style( 'mbsimplicity-style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'mbsimplicity_scripts_styles' );
But then your parent theme needs to not use get_stylesheet_uri()
but instead a function that returns the stylesheet URL for the parent theme, for example:
function modularbase_scripts_styles() {
wp_enqueue_style( 'modularbase-style', get_template_directory_uri() . '/style.css' );
}
add_action( 'wp_enqueue_scripts', 'modularbase_scripts_styles' );
Your completely correct and I totally missed this. Thank you very much for pointing this out.