Skip to content

Instantly share code, notes, and snippets.

View DivyeshPuri's full-sized avatar
:octocat:
I may be slow to respond.

Divyesh Puri DivyeshPuri

:octocat:
I may be slow to respond.
View GitHub Profile
@schilke
schilke / functions.php
Last active February 23, 2023 18:53
How to load CSS files asynchronously in WordPress (using Scott Jehl's "loadCSS")
<?php
// This is the cleaner code per request of a thread in the LinkedIn group "WordPress"
// ...
// register and enqueue loadCSS
function load_scripts_and_styles() {
// register loadCSS
wp_register_script( 'load-css-async', get_stylesheet_directory_uri() . '/path/to/js/loadCSS.js', array(), '', false );