WordPress.org

Forums

Point
[resolved] changing colors in child theme (13 posts)

  1. keeperbay
    Member
    Posted 1 year ago #

    When I hover over the categories in the nav bar at the top, the words vanish - I'm assuming that's because I changed the background of the nav bar to white and probably the text is also white.
    I can't find the area in the CSS to change the hover color to pink.
    I can change the non-hover color, but the hover color is hiding somewhere in the css and I can't find it. Can you tell me what it's called?
    (I copied the entire css to the child theme)

    Thanks

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    (I copied the entire css to the child theme

    Then remove the copied content. That's not how child theme's work. Only your custom CSS is added to the child theme. Perhaps you need to review child themes?

  3. keeperbay
    Member
    Posted 1 year ago #

    Disregard. It was: "Primary Color Scheme" which I took to mean, the color scheme of the theme and not the nav color.

  4. keeperbay
    Member
    Posted 1 year ago #

    I always copy the entire css to the child css, then I edit the child css. So much easier.

  5. esmi
    Forum Moderator
    Posted 1 year ago #

    And totally & utterly wrong. You need to review child themes.

  6. keeperbay
    Member
    Posted 1 year ago #

    I clicked the link, that's where I learn to make a child theme. Where does it say not to copy the entire parent css to be used in the child css?

    It does read: The child theme’s stylesheet is included after the parent theme's and styles will therefore override those in the parent theme’s stylesheet.

    But it doesn't say what terrible fate will befall the site that uses the entire parent css as the child css.

    What happens? Why shouldn't we?

  7. esmi
    Forum Moderator
    Posted 1 year ago #

  8. keeperbay
    Member
    Posted 1 year ago #

    The link that esmi keeps posting goes to a page that taught me how to create the child theme, it reads: The child theme’s stylesheet is included after the parent theme's and styles will therefore override those in the parent theme’s stylesheet.

    Meaning if you copy the entire parent css to the child css then the child css will override the parent css.

    No where does it read that any terrible fate will befall the site that uses the entire parent css as the child css.

    I'm not sure why esmi keeps posting a link that supports my point.

  9. esmi
    Forum Moderator
    Posted 1 year ago #

    In the example style.css file described under "How to Create a Child Theme", can you see the line:

    @import url("../twentyfourteen/style.css");

    That imports the parent's stylesheet "into" the child theme. So why are you copying it in again?

  10. That wording is confusing, I agree.

    In the case of a child theme, the parent's CSS file is not included by WordPress at all.

    However, in the example esmi is pointing to, the example includes this statement:

    @import url("../twentyfourteen/style.css");

    That has the effect of including the parent's stylesheet in the child's stylesheet.

    You *can* do it by copying the entire parent to the child, but that may be problematic if the parent uses its own imports and other stylesheets from the parent theme's directory. Using the @import method and then writing new CSS to override only the bits you want to change is a lot more manageable.

  11. esmi
    Forum Moderator
    Posted 1 year ago #

    Using @import also goes some way towards future-proofing the child theme as the parent' stylesheet is changed with future upgrades. Copying the CSS over wholesale completely wipes out that benefit. You might as well just fork the parent theme.

  12. keeperbay
    Member
    Posted 1 year ago #

    Let's say I do it your way. I like the width size 960px of the parent so I don't put that into my child theme because it's in the parent. On the next update the parent theme changes the width to 980px to accommodate some edit they made in the footer (it happened).
    Now the nav bar is suddenly across the top of the slider, the footer is screwed up and I'm stuck trying to figure out what happen and how to get it back to where it was.

    Pretty much I am junking the parent theme. I use the free themes to recreate the look of a lot of the premium themes or non-WP sites. I use a free theme that has some aspect of the premium/non-WP site so I don't have to start from scratch. I don't want any of the parent theme to show, because when I'm done there is very little of the parent theme left.

  13. If you're not planning on upgrading the parent theme at any future point, then there is no reason to use a child theme. Just rename the theme folder to something else, rename the theme similarly, and make your edits directly.

    The point of child themes is to add-on to a parent without changing the parent. But if you're making extensive changes, then you might as well just do it directly.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.