Why is style.css not being enqueued?

I got a pretty basic theme and just found out my style.css file doesn’t get loaded into the <head>. I already searched around but can’t find out, why it’s not loading. I inspected the global $wp_styles object already but couldn’t find anything: function style_test() { $wp_styles = new WP_Styles(); echo ‘<pre>’; // $wp_styles->enqueue == completely … Read more

Inbuilt style for jquery-ui-datepicker

I want to use the datepicker that gets bundled with WordPress on the front end of a website. I enqueued jquery-ui-datepicker but the datepicker isn’t styled(no js error in console). Is there a corresponding wp_enqueue_style for that? I used this code in functions.php function rr_scripts() { wp_enqueue_script( ‘jquery’ ); wp_enqueue_script( ‘jquery-ui-datepicker’, array( ‘jquery’ ) ); … Read more

Enqueue Google Web Fonts Without Messing Up Symbols In URL

Enqueuing Google Web Fonts the usual way, i.e., using the wp_enqueue_style function like so… function wpse_google_webfonts() { wp_enqueue_style( ‘google-webfonts’, ‘http://fonts.googleapis.com/css?family=Ubuntu+Condensed|Open+Sans:400italic,700italic,400,700’ ); } add_action( ‘wp_enqueue_scripts’, ‘wpse_google_webfonts’ ); …results in a link tag placed in the header like so: <link rel=”stylesheet” id=’google-webfonts-css’ href=”http://fonts.googleapis.com/css?family=Ubuntu+Condensed%7COpen+Sans%3A400italic%2C700italic%2C400%2C700&#038;ver=3.5″ type=”text/css” media=”all” /> As you can see, the resultant URL is encoded. I am … Read more

How to load scripts/styles specific for a page

I know that according default WordPress boot process, firstly functions.php is called, after that goes all theme stuff. But I am currently going to refactor my theme completely to optimize it. My idea is to have one base css file for common properties, normalize, colors. Or to keep single css file, but in this case … Read more

Remove Open Sans from Twenty Twelve theme

I´m creating a child theme for Twenty Twelve v1.0 and I want to remove the Open Sans font. Open Sans is added in Twenty Twelve´s functions.php: wp_enqueue_style( ‘twentytwelve-fonts’, add_query_arg( $query_args, “$protocol://fonts.googleapis.com/css” ), array(), null ); I´ve tried to deregister/dequeue the stylesheet in my childtheme´s functions.php (see examples below) but to no effect: function example_scripts_styles() { … Read more

Prevent Version URL Parameter (?ver=X.X.X) on Enqueued Styles & Scripts

Use Case I’ve been experimenting with Chrome’s Dev Tools Workspace features. It includes the ability to edit a file directly in Dev Tools and have the saved stylesheet refresh itself (or even compile and then refresh!). However, as documented in the StackOverflow question “Chrome’s “Auto-Reload Generated CSS” not reloading page when SASS recompiles CSS”, URL … Read more

Load CSS/Javascript in frontend conditionally if block is used

Assuming I have no infinite scroll or anything else going on in my theme: Is there a way to enqueue my custom Gutenberg block styles and scripts so they are only (lazy) loaded in the front-end when the block is really used? Something like is_active_widget, just for blocks? If I enqueue them inside a enqueue_block_assets … Read more

Style custom columns in admin panels (especially to adjust column cell widths)

I am using WordPress as a CMS for a project which makes extensive use of custom post types. I need to display columns in admin panels for each custom post type in a different way. I’ve already created the necessary columns and populated them. What I need to do is to adjust the CSS a … Read more

How to add crossorigin and integrity to wp_register_style? (Font Awesome 5)

I am upgrading Font Awesome 4 to version 5 which introduces both integrity and crossorigin attributes to the <link rel=”stylesheet”> markup. Currently, I am using: wp_register_style(‘FontAwesome’, ‘https://example.com/font-awesome.min.css’, array(), null, ‘all’ ); wp_enqueue_style(‘FontAwesome’); Which outputs as: <link rel=”stylesheet” id=”FontAwesome-css” href=”https://example.com/font-awesome.min.css” type=”text/css” media=”all” /> With Font Awesome 5 it introduces two new attributes and values (integrity and … Read more