Support » Fixing WordPress » Parent theme loads after child theme

  • Resolved lily_ella

    (@lily_ella)


    Hi,
    I created a multisite for my website: http://www.leslieghekiere.com and http://www.leslieghekiere.com/en
    I set up a child theme for my both using Twenty Eleven (light). But the changes I made to my child style.css are not overriding my parent theme.

    this is the code I used for creating my child style.css

    /*
    Theme Name: Twenty Eleven Child
    Template: twentyeleven
    */

    @import url(“../twentyeleven/style.css”);

    What I wanted to do was remove the title on each page. When I copy/paste the text from the content-page.php into the child style.css and remove the title line, nothing changes. I tested it with removing that line in my parent style.css, then the title was gone on my site. But it would be better when I can do it in my child style.css. When I viewed the source code for the website, I found that the parent is being loaded after the child. Is there a way to change the order so that the child is being loaded after the parent?

Viewing 7 replies - 1 through 7 (of 7 total)
  • leejosepho

    (@leejosepho)

    I tested it with removing that line in my parent style.css

    There might be a few simple lines you can add to your Child Theme to display: none, or something like that, and I think the Child Theme loads first by design so WordPree can know what to overwrite when it gets to the Parent Theme. Also, and while I am not a coder, I am pretty sure you cannot put PHP stuff in a CSS sheet.

    Each theme and plugin has its own Support Forum, and you would likely get a more helpful response over here:
    http://wordpress.org/support/theme/twentyeleven

    WPyogi

    (@wpyogi)

    @leejosepho is correct – you cannot put anything in the style.css file except CSS.

    Try this in the child theme style.css file – it works fine in Firebug:

    .singular .entry-title {
       display: none;
    }

    Clear your browser cache after making the change.

    lily_ella

    (@lily_ella)

    Thanks ever so much! I tried it and it worked immediately. Did not even have to clear my broswer cache.
    I had no idea you couldn’t put php in a css sheet. Have been looking at this for two days. Thanks again for the help!

    crsneilhedley

    (@crsneilhedley)

    Actually, yes you can. Been doing it for years. And it’s a remarkably easy thing to find on The Google Machine.

    Here’s some basic info./

    leejosepho

    (@leejosepho)

    Yes, style sheets can contain php, but not like this:

    When I copy/paste the text from the content-page.php into the child style.css…nothing changes.

    I should have spoken more precisely!

    crsneilhedley

    (@crsneilhedley)

    Technically you’re right – a CSS file can only contain CSS, but it’s VERY possible to have a “style.php” file that outputs CSS.

    I wasn’t trying to call you out or anything like that, @leejosepho, but I didn’t want the thread to leave the OP under the impression that what they were trying to do was impossible.

    🙂

    leejosepho

    (@leejosepho)

    I wasn’t trying to call you out or anything like that, @leejosepho, but I didn’t want the thread to leave the OP under the impression that what they were trying to do was impossible.

    🙂

    Understood, and clarification is always helpful!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Parent theme loads after child theme’ is closed to new replies.