How To Load wp_add_inline_styles

You need to add enqueue your child themes style sheet as well add_action( ‘wp_enqueue_scripts’, ‘inline_bar_width’ ); function inline_bar_width() { wp_enqueue_style( ‘twentytwenty-style’, get_stylesheet_directory_uri() . ‘/style.css’ ); if ( is_category( ‘ratings’ ) ) { $bar = bar_width(); $css=””; $css .= sprintf(‘.bar {width: %s%%;}’, $bar ); if ( $css ) { wp_add_inline_style( ‘twentytwenty-style’, $css ); } } }

Use conditionals with wp_enqueue_style to attach stylesheet according to post type displayed

The issue in your first block of code is syntax: if( get_post_type() == ( ‘activity’ OR ‘dining’ OR ‘heritage’ OR ‘hiking’ OR ‘nightlife’ ) ) : this isn’t proper use of OR and will evaluate true regardless of what get_post_type() returns. The issue in your second block is again syntax, you have to break; at … Read more

Deregister a CSS file that comes with a plugin

You can use wp_dequeue_style function, with a wp_enqueue_script hook with priority higher than WPML’s wp_enqueue_script hook. Put the following code into your functions.php: function dequeue_wpml_styles(){ wp_dequeue_style( ‘wmpl_style_handle’ ); } add_action( ‘wp_enqueue_scripts’, ‘dequeue_wpml_styles’, 20 ); REPLACE ‘wmpl_style_handle’ with the handle WPML registers/enqueues the style. UPDATE: I have just had a look into WPML and it looks … Read more