WordPress.org

Ready to get started?Download WordPress

Forums

Special Recent Posts
Suggestion (7 posts)

  1. trinzia
    Member
    Posted 1 year ago #

    Hi,
    I notice your stylesheet uses !important quite often, which is causing me some minor irritation while overwriting your styles for my theme. Perhaps you could remove them from the original?
    For example, I am wasting time trying to overwrite the border in a css file in my theme, and it's not working:

    div.srp-widget-singlepost {
        border-bottom: 1px solid #CCCCCC !important;
        clear: both !important;
        margin: 0 0 10px !important;
        padding: 0 0 10px !important;
    }
    div.srp-widget-singlepost {
        border-bottom: 1px solid transparent! important;
        clear: both !important;
        margin: 0 0 10px !important;
        padding: 0 0 10px !important;
    }

    I also cannot figure out how to de-queue or de-register your stylesheet. if you would just delete every occurence of !important, everything might be fine.

    Thanks.

    http://wordpress.org/extend/plugins/special-recent-posts/

  2. Luca Grandicelli
    Member
    Plugin Author

    Posted 1 year ago #

    Sometimes the wordpress main stylesheet can override some widget/plugin styles. that's why, in order to preserve the basic layout of the SRP widget, !important is used.

  3. esmi
    Forum Moderator
    Posted 1 year ago #

    Sorry but that's just plain wrong/lazy! You should never use important in a plugin's stylesheet as this effectively stops anyone from theming the plugin's output to match their site. Try increasing your CSS specificity instead if you're worried by general themes CSS issues.

  4. Luca Grandicelli
    Member
    Plugin Author

    Posted 1 year ago #

    First of all, i can't know in advance what kind of html structure the plugin will fit into, so basically there is no CSS specificity you can apply to. Instead, the best you can do is to match the plugin generated output on a global way.

    It is true that the "!important" rule should never been used, but this unless you are deploying a software that will embedd itself in the most various html enviroments. Infact in this case, if you wish to preserve some layout settings (like the multi column output for instance), you have to make sure no previous theme css will override that rule.

    Please also remember, that the plugin css is fully configurable and editable, so i don't see the point why this plugin should block people from customizing their theme.

  5. esmi
    Forum Moderator
    Posted 1 year ago #

    If all of your plugin's CSS used its own ids and classes (something like #spr-xxx and ..spr-yyy), and you re-designed the HTML output to use the classes, you could get rid of all of the !important entries.

    I help to develop a pretty bug ecommerce plugin (especially the markup & CSS side of things) and, even with over 100K users, we've not yet had a single issue of a CSS conflict. Even though the plugins ships with CSS that allows someone to drop it straight into the Twenty Eleven theme.

    It really is worth the initial effort and, once the basics are in place, it just becomes second nature with future upgrades/extensions.

  6. Luca Grandicelli
    Member
    Plugin Author

    Posted 1 year ago #

    Just for the knowledge: SRP output html has its own classes and ids. By the way, thanks for the conversation.

  7. trinzia
    Member
    Posted 1 year ago #

    Hi Luca,
    For clarity, I am designing themes for which I am not the end-user/admin. Therefore I do not know which plugins will be installed. Since I am providing only the theme, I do not include plugins or CSS files in the plugin directories.

    While you are correct that I could easily fix it on a case by case basis, there isn't any way to fix it only within the construct of my theme. So as a theme author, rather than a publisher, I find it inconvenient.

    If the CSS is difficult, perhaps you could include a line where it is clear how to de-queue your stylesheet in my functions.php.

    Thanks for your consideration.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags