twentig-theme-custom-css should load with wp_enqueue_style
-
I think you should load your custom CSS the normal way.
instead of injecting css as echo in head it should be enqueued like normal wordpress. I tried to override it from a child theme but it was just not working because wp_head comes after wp_enqueue_scripts so there’s no real way to modify it without editing core twentig code.
injecting also messes with optimisation plugins and anyone who tries to manually override any twentig custom colours by loading their css after twentig, you just cannot do it without weird hacks.
for twentig_twentytwenty_print_customizer_css
change wp_head to wp_enqueue_scripts
change from
if ( $css ) : ?> <style type="text/css" id="twentig-theme-custom-css"> <?php echo twentig_minify_css( $css ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> </style> <?php endif;
to
if ( $css ) : wp_register_style('twentig-theme-custom', false,['twentytwenty-style','twentig-twentytwenty','twentig-blocks']); wp_enqueue_style('twentig-theme-custom', null); wp_add_inline_style('twentig-theme-custom', $css); endif; } add_action( 'wp_enqueue_scripts', 'twentig_twentytwenty_print_customizer_css' );
- The topic ‘twentig-theme-custom-css should load with wp_enqueue_style’ is closed to new replies.