WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Parent theme loads after child theme (8 posts)

  1. lily_ella
    Member
    Posted 8 months ago #

    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?

  2. leejosepho
    Member
    Posted 8 months ago #

    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

  3. WPyogi
    Volunteer Moderator
    Posted 8 months ago #

    @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.

  4. lily_ella
    Member
    Posted 8 months ago #

    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!

  5. crsneilhedley
    Member
    Posted 8 months ago #

    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./

  6. leejosepho
    Member
    Posted 8 months ago #

    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!

  7. crsneilhedley
    Member
    Posted 8 months ago #

    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.

    :)

  8. leejosepho
    Member
    Posted 8 months ago #

    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!

Reply

You must log in to post.

About this Topic

Tags