• Resolved oldmanhouse

    (@oldmanhouse)


    I have a simple child theme whose parent is “twentyten”. I called it “twentyten-child”. Right now, it only consists of a style.css and a header.php

    style.css is as follows:

    /*
    Theme Name:     TwentyTen child
    Description:    Child theme for Twenty Ten
    Author:         James
    Template:       twentyten
    */
    
    @import url("../twentyten/style.css");
    body.custom-background {
        background-color: red;
    }

    I’ve inserted the alternate background-color CSS in order to test if the child is overriding the parent’s background-color setting for body.custom-background (which is black). I can see that my child theme is being loaded – it’s in the <style> tag in the page <header>, but my customisation doesn’t kick in.

    Changes to the <title> located in my child theme’s header.php don’t happen either.

    Is there some bug with 3.3 as I’ve seen others suggest? Or am I doing something wrong?

    Many thanks

    P.S. The site in question is tbmsussex.co.uk

Viewing 11 replies - 1 through 11 (of 11 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Try single quotes?

    /*
    Theme Name:     TwentyTen child
    Description:    Child theme for Twenty Ten
    Author:         James
    Template:       twentyten
    */
    
    /* Get base CSS */
    @import url('../twentyten/style.css');
    
    body.custom-background {
        background-color: red;
    }
    Thread Starter oldmanhouse

    (@oldmanhouse)

    Thanks for the suggestion, but still not working unfortunately ??

    It’s definitely importing the parent style.css as I can see it linked to in the page source:
    <link rel="stylesheet" type="text/css" media="all" href="https://tbmsussex.co.uk/wp-content/themes/twentyten-child/style.css" />

    does it say that your child theme has no parent installed on the themes page? My child themes broke when updating to 3.3 and it says the parent isn’t installed even though I can activate it. unfortunately, after activating, I couldn’t activate the child theme anymore so I had to find stylesheet under wp_options in the database and change it to the folder name of the child theme as a work around till wordpress gets this bug resolved…

    Thread Starter oldmanhouse

    (@oldmanhouse)

    Not getting any error messages on the Themes page. As far as I can see, it should all be functioning correctly as I’ve got the parent and child directories in the right place, with the right names and the child style.css has the correct “Template” option.

    In the wp_options table, I have the following fields:
    template: twentyten
    stylesheet: twentyten-child

    Does that look right? What was the field you had to change Brettman?

    I changed stylesheet. you keep template as the parent. mine is currently using the parent theme with the child theme stylesheet because it wasn’t changed with wordpress but in the backend. where your stylesheet says template, check that the value twentyten is the same as where twentyten’s stylesheet says theme name (it IS case sensitive). Also, your child theme’s folder should be in wp-content/themes/ and not in the parent theme’s folder (some people do that and wonder why it doesn’t work).

    scratch what I said about template saying the same thing as theme name of the other theme. it should be the name of the parent themes folder but is still case sensitive though…

    Thread Starter oldmanhouse

    (@oldmanhouse)

    I guess that rules out a miscommunication between the frontend and the database then, as the parent theme directory is called “twentyten” which matches up with what’s in the database.

    The page is definitely loading my child style.css, but it’s being overridden by the parent. This can be seen in Firebug: link

    My “background-color” CSS from the child style.css is getting disregarded. The same goes for a h1 { color: red; } which I added in, just to see if it’d disregard that too…

    Did you ever figure it out? It doesn’t make any sense to me why your stylesheet wouldn’t take precedence. Do you know how to use the code inspector in chrome or firebug in firefox to see your styles and how they’re processed?

    Thread Starter oldmanhouse

    (@oldmanhouse)

    I never did work it out.. However, I found that the important things that I actually wanted to override were overridden fine. In my tests posted above, I was trying to change stuff like the colour of h1 tags (something I didn’t actually want to do – but was just testing how overriding worked).

    When it came down to it, I got what I wanted to do done!

    Thanks for all the replies. Shame we couldn’t get to the bottom of it, but dammit we tried!!

    It may have been just that your initial attempt was an unfortunate choice!

    If you look at your source output in the browser, up in the head section

    <style type="text/css">
    body.custom-background { background-color: #401f1f; }
    </style>

    Gets output in there as inline css. So your child style.css may have been getting that particular option overridden by inline css from the background colour chooser feature of WP

    Choosing link colours also gets output into the head the same way (at least in 2011, I can’t recall if 2010 had that option)

    Thread Starter oldmanhouse

    (@oldmanhouse)

    Unfortunate indeed! As there was an entry of two for custom-background in style.css, I never guessed it was in-line as well.

    As you can see from my Firebug screenshot https://img827.imageshack.us/img827/6723/firebugq.jpg, it reports the CSS as being at line 30 of the domain name. I didn’t put 2 and 2 together and realise it meant index.php!

    So, yeah. If anyone else is having this issue – check your php files as well as the style.css file for anything that may be overriding your child theme!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Child theme not overriding parent in 3.3’ is closed to new replies.