Help moving style.css to footer

Posted in: Newsmag
Post count: 9544

Hey party people …!

Does anybody ’round these parts know a theme agnostic way to move the main WP style.css from the head to the foot, which WP doesn’t seem to want to do ?

Trying to figure out way to re-enqueue that to footer and having trouble finding a way to do so without some bozo claiming “you don’t want to do that …” when, YES, I do need to do that.

Or, how to un-enqueue it from header completely, and then manually add to footer.

Seems I’m in the minority of folks doing critical CSS front loading for speed.

Thanks in advance folks!

Post count: 93

If you are using “W3 total cache” or whiling to start you can do it with it.
Go to Performane – Minify (don’t worry no need to minify them), insert the url of the css and choose embed to footer from the dropdown.
That’s it.
You can do it for any css or js in the page.
minify

Post count: 9544

Hm. Prefer to do this as a function, by de-enqueuing the hook, and I think I “might” have that sorted. And of course we don’t want anything minified by a plugin as we do that properly for static files for both js and css ahead of time …

Good thought, though, THANKS — appreciate the feedback! 🙂

We will be using WP Super Cache for this particular in house project.

I think I might have it sorted by doing a de-enqueue function, de-register, in functions.php — so just need to test that.

Have 99% on GTMetrix and down to 1.1 sec with photo and https but no caching plugin! — but only 92 desktop and 78 mobile on Google’s PageSpeed Insights test directly, due to the pesky render blocking crap. If I can get that damn last css file to footer, I’ll be in the home stretch.

Trying really hard to get WordPress to be as fast as our static main part of site where we have 100/100 out of all 3 tests with Google PSI. I’ll get there!! 🙂

Post count: 93

Yeah i figured you needed a function. I knew that method and there was a slight change you used that plugin so i mentioned it. Hope you find a way! (:

Post count: 9544

function custom_dequeue_stylesheet() {
wp_dequeue_style( 'theme-style' );
}
add_action( 'wp_enqueue_scripts', 'custom_dequeue_stylesheet', 99 );

Post count: 6600

@Chris That should do it. As a reference you may also look into theme’s speed booster plguin at the methods used there: http://screencast.com/t/Ukfejv54xUyk

Hope you’ll find this useful!

Post count: 9544

Thanks Lucian 🙂

With Speed Booster, that’s awesome.

Viewing 7 posts - 1 through 7 (of 7 total)
The forum ‘Newsmag’ is closed to new topics and replies.