WordPress.org

Ready to get started?Download WordPress

Ideas

Provide a theme 'style.css' override

  1. ariejan
    Member

    Some themes already feature a separate options page and some of those allow you to enter custom CSS that will override the styles defined in style.css

    Why is that great? You can easily change the look of a theme without having to change the style.css itself. When you upgrade the theme, your changes are kept and you don't have to tweak style.css all over again.

    It'd be great if WordPress would have such a feature. Just a box that allows you to add custom css that is included after the theme css.

    Posted: 4 years ago #
  2. kylegetson
    Member

    I think there are plugins for this. If not, let me know and I can build one real quick. If your looking to simply have a section of styles consistently on your site, regardless of the theme selected, this wouldn't be too hard to build.

    Posted: 4 years ago #
  3. syncbox
    Member

    All you have to do is add your own style sheet AFTER the call to the default one. Then, in your sheet, add same rule with different values or properties. Since it comes later, cascade comes into effect, overwriting previous values.

    Or, you can write conditional code to echo style rules if in specific pages or categories, etc.

    With CSS, it's cascade and specificity that count. The other thing is writing the style inline, if you have one or just a couple of places where you want to overcome a set value for an element's properties.

    And, you don't have to use ANY of the IDs, classes, etc in a style sheet OR even the markup that comes with themes for WordPress to work as long as your files are done correctly and the logic is inserted properly.

    Posted: 4 years ago #
  4. Mark / t31os
    Moderator

    12345

    Maybe a comprimise would be in asking that theme authors start adding filter hooks so you switch stylesheet, as appose to performing an override..

    Something as simple as..

    <link rel="stylesheet" href="<?php apply_filters( 'active_theme_stylesheet' , get_bloginfo('stylesheet_url') ); ?>" type="text/css" media="screen" />

    Which would then give you the opportunity to use the filter hook active_theme_stylesheet to override the path to the default stylesheet.

    It's an untested theory, but i think that would work. At least this way you're taking the default stylesheet out of the equation, not needlessly loading it, only to load a futher one that overrides everything in the first.

    Posted: 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    12345
    5 Votes
  • Status

    This idea has been implemented