Theme stylesheets hooked into wp_print_styles cause issues with plugin
-
I ran into an issue with this otherwise lovely theme: Lovecraft hooks its stylesheets into
wp_print_styles
while they should be enqueued viawp_enqueue_scripts
.Enqueuing stylesheets properly gives plugins like Simple Custom CSS a chance to hook in after all theme stylesheets have been loaded, so they can be overridden with custom styles via the plugin. (I usually go for a child theme, but this time had to be quick and dirty.)
A rewrite of how
lovecraft_load_style()
is hooked could fix the issue:function lovecraft_load_style() { wp_enqueue_style( 'lovecraft_googleFonts', '//fonts.googleapis.com/css?family=Lato:400,700,900|Playfair+Display:400,700,400italic' ); wp_enqueue_style( 'lovecraft_genericons', trailingslashit( get_stylesheet_directory_uri() ) . 'genericons/genericons.css' ); wp_enqueue_style( 'lovecraft_style', get_stylesheet_uri() ); } add_action( 'wp_enqueue_scripts', 'lovecraft_load_style' );
Would love to see something like this in the next compatibility update of the theme.
Thanks,
Caspar
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Theme stylesheets hooked into wp_print_styles cause issues with plugin’ is closed to new replies.