• Resolved theArab

    (@thearab)


    Hello, I’m new to the forum and pretty new to WordPress.
    So please be kind to me!
    I’ve recently built a plugin and for the most part it’s working great.
    Functionally it’s working perfectly.
    But I’m having a rather difficult time getting the style sheet of my plugin to work with a variety of themes.
    It seems that with some themes, it looks perfect. 🙂
    Sadly, on others it is completely hideous! 🙁
    This is mostly on themes with a darker scheme, but it happens on some intricate ones too.
    It looks like some themes override my style sheet completely.
    I’ve looked all over for a solution, tried enqueing my style sheet as is suggested in the forum here.
    But this never has any effect.
    My style sheet is dynamic — it allows the admin to pick from some pre-set color patterns.
    So the CSS file is actually a PHP file that loads variables into the css.
    I don’t know if this is why enqueing does not work?
    I AM able to override some themes styles by using “!important” on my own style sheet.
    But I’m not happy with this because sometimes it totally bungs up the rest of the theme.
    I’m sure there must be a solution to this that I just can’t seem to figure out.
    I’d absolutely LOVE to get this so that it works with the individual theme’s settings.
    Can anyone suggest anything or point me in the right direction of some quality reading?
    Sometimes I just don’t know the exact term I should use to search for and once I get there I can usually figure it out.
    Anyhow, if anyone has any suggestions — I humbly appreciate any help! Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • I would use very specific naming of css-classes. Like:

    .my-very-special-plugin h1

    and also be very specific in your stylesheet, like:

    body > .my-very-special-plugin-container > h2.my-very-special-plugin-header

    Try wrapping your markup with a wrapper div with a specific class.

    Other than that, there will always be a problem with conflicting styles.

    A link to your plugin would be helpful.

    Good luck

    Thread Starter theArab

    (@thearab)

    Thanks so much for taking the time to reply! I’ll try it out! Cheers! Sorry I spaced out on leaving a link. here it is: https://wordpress.org/plugins/skedmaker-online-scheduling

    sent a link of your site and what you would like to happen.

    Thanks!

    Thread Starter theArab

    (@thearab)

    Thanks. I edited a lot of my CSS, but it is still a tad clunky on some themes. Looks like some are formatting certain elements and ignoring my styles, unless I add !important to the attribute. But then, when I do this, it modifies the rest of the CSS on the theme. That’s a bummer. But there is not much else I can find to be a solution for it.
    \

    But if you use unique class names and only use !important on those classes and not on general tags like p or h2, then the !Important parameter should only affect your styles.

    Thread Starter theArab

    (@thearab)

    Thanks for the help guys! It looks like when I use, for example, a <td> tag the style for it being overrrided — or even better appended. The theme style will add to my style for the <td>. For example, if I have in my css something like this:

    td.sm-pad7border{padding:7px; border:1px solid #333; text-align:left;}

    The css from the theme is also being applied to the td.
    And only if I anticipate any css from the theme can I overrride it with !important in my css.

    I’m not sure if it would be wiser to name my individual css for these without the td. ? and just name it .sm-pad7border{style here;} instead?

    If this is resolved please post as resolve if not please mention additional help needed.

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘CSS problems with plugin’ is closed to new replies.