I am using the theme twentyten
as a parent theme for my child theme. I have other stylesheets I want to use and so I’m trying to figure out how to wp_deregister_style
for the style.css
sheet that is printed out in the head
section of the html.
I have checked the global $wp_styles
variable around the shutdown
hook and I see the other styles but not style.css
– how can I get my child theme to stop using it?
I realize the theme name and info has to be stored here – I don’t want to delete it, I just don’t want it to be enqueued
2 Answers
Twentyten has a header.php
file which has the style.css hardcoded into it:
<link rel="stylesheet" type="text/css" media="all" href="https://wordpress.stackexchange.com/questions/40174/<?php bloginfo("stylesheet_url' ); ?>" />
There is no way to wp_dequeue_style
because it is never “loaded” with wp_enqueue_style
in the first place.
To get that out of the header you’ll need to edit the twentyten theme (bad idea) or copy the header.php
file over to your child theme so that it will override the original one and edit the file there (better idea), or as you mentioned, use a different base theme which does not have the style.css
file hard coded into the header.php
file, or if you will be using another stylesheet, use add_filter()
to override what stylesheet_uri()
returns with the new file (best idea).
Notes
Usage: <?php get_stylesheet_uri() ?>
- Uses: apply_filters() Calls ‘stylesheet_uri’ filter on stylesheet URI path and stylesheet directory URI.
- Uses: get_stylesheet_directory_uri()
From http://codex.wordpress.org/Function_Reference/get_stylesheet_uri: