0

I'm deving a new header (working on a page that includes that new header). I want to edit my head section to NOT load my stylesheet and load a different stylesheet (style2.css).

I've spent the last 2 hours trying to do this with various methods online. It keeps loading my original stylesheet and won't load the styles in my style2.css no matter how I point to it.

(I've refreshed cache, etc.)

Can anyone please just say what to put in head to tell the page to forget about the style.css and load another stylesheet? I know how to do child themes but I want to edit in the live theme.

I will also be happy if someone can tell me how to not load style.css on the page (even that will help)

Thanks

1

There are a few ways to do this depending on your preferred approach and the current theme you are working in.

The "WordPress Way" would be to enqueue the new style sheet in functions.php using wp_enqueue_style()

https://codex.wordpress.org/Function_Reference/wp_enqueue_style

You can remove the reference to the original stylesheet by deleting the reference to it in your existing theme. Depending on the theme the style sheet may be loaded directly in header.php or enqueued elsewhere, perhaps in functions.php (really depends on the theme).

If you still can't find it you can try to dequeue it in functions.php using wp_dequeue_style()

https://codex.wordpress.org/Function_Reference/wp_dequeue_style

If all else fails a last resort might be to delete the styles from that style sheet and replace them with new ones. Just be sure not to delete the comments at the top of style.css as WordPress relies on those notes for important theme details.

|improve this answer|||||
  • Hi dswebsme, Thanks for the response. The thing is I'm trying to not include styles "on a specific single.php." If I wanted to not load it on the theme, I could just rename the style.css and it would fail to load (or a number of other methods). I want my site to continue normally (so not dequeue-ing a style sheet for the whole theme in functions) while I work on the single.php in question. Thanks anyways – James Frank Haleavy Oct 2 '15 at 6:39
  • The dequeue helper works from single.php as well. – dswebsme Oct 2 '15 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.