how to de-enqueue main css stylesheet ?

Posted in: Newsmag
Post count: 9544

Hi
in Newsmag 3.1

trying to remember which “ID” to use to de-enqueue the main css ..

... <link rel='stylesheet' id='td-theme-css' ...

trying it this way in functions.php

function dequeue_my_css() {
wp_dequeue_style('td-theme-css');
wp_deregister_style('td-theme-css');
}
add_action('wp_enqueue_scripts','dequeue_my_css',100);

been awhile since did this with newsmag… brain not working … 🙂

Post count: 23312

Hello Chris,

If you want that your style.css to remain to the header section you should edit the td-speed-booster.php and comment out this line, like this -> https://www.screencast.com/t/j9B01harJ
As you can see in td_wp_booster_functions.php core file, the theme will enqueue the theme style using this ID ‘td-theme’, like this -> https://www.screencast.com/t/EwnnFyTkoex

Thanks for your understanding!

Post count: 9544

I basically need to *REMOVE* the theme inserting the link to main style sheet in the header.

Normally one can “de-enqueue” that based on the ID of the stylesheet but I get tripped up often enough trying to figure out the right ID for the actual CSS or js sometimes.

Not using speed booster plugin with the theme as we have our own internal optimization setup, but I think the second link you gave showing ‘td-theme’ as the right ID might be what I was looking for.

So, I’ll try it this way since I guess the ‘css’ was redundant — those IDs always trip me up! 🙂

function dequeue_my_css() {
wp_dequeue_style('td-theme');
wp_deregister_style('td-theme');
}
add_action('wp_enqueue_scripts','dequeue_my_css',100);

Thanks! (and happy new year!)

Post count: 9544

Hmmm…
using either ‘td-theme’ or ‘tdtheme’ does not un-enqueue (remove) the main style.css from head.

Hmmm…
oh…

// 1001 priority because visual composer uses 1000 function load_front_css() {

will try de-enqueue priority of 1100

yep … that was the trick, I had upped priority to 999, but you clever folks had it at 1001 … 🙂

Sorted!
Thanks

  • This reply was modified 9 years by simchris.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.