SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: overriding css

  1. #1
    SitePoint Addict mari's Avatar
    Join Date
    Nov 2007
    Location
    London, UK
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question overriding css

    Hi Guys,

    im having trouble figuring this out

    im using wordpress and a plugin for forms

    the plugin calls in its own css

    but i want to use my own css and i cant edit the stylesheet already being used as this is also being used across other websites on the same installation of WP

    i know how to target ids but is there another way of overiding the css as i dont want to do this for every element in a form

    also for things like <label> they do not have an id or class assigned to it and i cant seem to over ride them?

    help is appreciated

  2. #2
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,805
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    If I understand your conundrum correctly, you cant go back an alter the CSS file, save as, and then have the plug in call altered file?

    Writting CSS 'inline' seems to be what you are suggesting. This means writing it withing the HTLM tags as such <label style="css declarations go here">.


    I am not certain of your WP config but I would suggest the following two experiments:

    1 ) Try hard coding a <LINK> to your own stylesheet, in the HEADER template page for your form.. Make sure the link is the LAST tag before you close the </HEAD>. Since it's the last style sheet imported it will override all previous written rules , except those written "inline" ; I am assuming this plug in isn't so bold as to write it's on CSS inline.

    2) IF that doesnt work or if the forms templates are shared across the installation ( in which case you couldnt even write your CSS inline anyways, as that would alter said templates ). I would use a lil PHP slight of hand. It's simple but it is a a BAND AID method.

    You will need to know the name of your site, or some specific info in the DB that is unique to your site. for the sake of example i will use get_bloginfo ('name') to get your site name. RIGHT BEFORE the </head> tag, add this:


    <?php
    if ( get_bloginfo ('name')=="your site name") {echo "\n <LINK REL=StyleSheet HREF='path/youtstyle.css' >\n";}
    ?>

    essentially, this if statement will check the blog/site name, if it's " your site name" it will add the link to your custom styles.

    hope that hepls

  3. #3
    SitePoint Addict mari's Avatar
    Join Date
    Nov 2007
    Location
    London, UK
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wow such an easy solution in the end, i just did as you said about putting it right before the head tag closes and it has overridden the plugin style

    i googled this all day yesterday and didnt find a solution

    thank you so much

  4. #4
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,805
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    glad to have helped. ==


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •