WordPress.org

Ready to get started?Download WordPress

Forums

How do you override styles that have been set by your widgets? (7 posts)

  1. powerboys
    Member
    Posted 6 years ago #

    I've noticed that two of the widgets I am currently using, Lastfm records (http://dirkie.nu/projects/lastfmrecords/) and WP Random Quotes (http://www.benched42.net/) add their own styles to the head of each page that they show up on.

    I don't like the default styles and want to change them, but I can't work out how to change my styles.css in such a way to override what is in the page itself.

    I'm probably just showing my css ignorance, but whatever changes I make to (for example) the border, which is defined in the head get ignored. If I define something different (eg display: none) that works.

    I've tried !important, but I'm either doing it wrong, or don't correctly understand what it is for?

    Any ideas?

    If it helps, look at http://shayne.powerlot.net - the Lastfm records are at the bottom. I am trying to style them like the flickr photos above them.

    Thanks

    Shayne in .au

  2. Jeremy Clark
    Moderator
    Posted 6 years ago #

    If the plugin doesn't have a separate stylesheet in it's plugin directory then you'll have to edit the plugin itself. I personally hate plugins that do that.

  3. powerboys
    Member
    Posted 6 years ago #

    I was afraid you were going to say that.

    Can I get a second opinion (and will it make any difference?)

  4. moshu
    Member
    Posted 6 years ago #

    Yes, I "second" Jeremy :)

  5. powerboys
    Member
    Posted 6 years ago #

    Thanks Jeremy, moshu

    I was hoping for a css-only solution, but knowing what was going on a bit better has helped me find an easy-ish solution.

    In both of my problem plugins, the css styling is in a function, which is then called elsewhere. Rather than mess about with the styles, I have simply commented out the call to the style function.

    Eg in last.fm.php there is a call (line 1042 in the version I have)
    add_action('wp_head', 'lastfmrecords_stylesheet');

    Commenting this out means the <head> no longer has the offending styles, but the classes etc still appear in the html.

    Not ideal, but it works. Issue resolved (though now I have to remember to makes the changes again if I download an update!).

    Thanks.

  6. billh
    Member
    Posted 6 years ago #

    I am the author of the WP Random Quotes. The styles added by the plugin are nearly all margin and padding settings so that the quotes appear indented on the sidebar or page. There is ONE font change - to make the author's name boldfaced and right-aligned.

  7. powerboys
    Member
    Posted 6 years ago #

    That's all well and good, your style choices seem perfectly reasonable, but what if they don't fit with the rest of my theme and I want to change them a bit.

    I can't.

    Please don't take this the wrong way. Your plugin is great and I didn't pick on yours especially, I just noticed the problem (as I see it) on it.

    Also note that the author of the last.fm plugin I mentioned has added an option to include the css or not. In other words, he (like you) has ideas on what makes for good mark up on his plugin, but now gives me the option to turn it off and to make my own decisions.
    http://wordpress.org/support/topic/135241?replies=5

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.