WordPress Plugin: using php to output styles in stylesheets

I am currently developing a WordPress plugin and the code below is saved in a file called style.css

.toggle { background:url(images/plus.png) 0     5px scroll no-repeat;  margin-top:20px; padding:0 0 0 35px; display:block; text-transform: normal; font-size: 18px; position:relative; line-height:25px; }
h4.toggle a                     { color: #888; padding-top:2px; text-decoration: none; text-transform: normal; }
h4.toggle a:hover               { color:#666;}

h4.active                       { background:url(images/minus.png) 0 5px scroll no-repeat;  display:block;}
h4.active a:link                { color:#666;}

.toggle_content                 { clear:both;  margin:0px;  }
div.toggleinside                { padding:15px; padding-left:35px;}
h4.toggle                       { margin-bottom:0}


.fancytoggle        { 
    position:relative; 
    border:1px solid #ccc !important;   
    background-color:#fff; 
    padding:10px; 
    margin-bottom:10px; 

    background:-moz-linear-gradient(bottom, #f2f2f2 0px, #fff 100%);
    -moz-box-shadow:0px 1px 1px #aaa;

    background:-webkit-gradient(linear,left bottom,left top, color-stop(0, #f2f2f2),color-stop(1, #fff));
    -webkit-box-shadow:0px 1px 1px #aaa;

    box-shadow:0px 1px 1px #aaa;
}

.fancytoggle h4                 { margin:0 0 2px 0; }
.fancytoggle .toggle_content    { padding-bottom:0; }

However as this is a wordpress plugin i can’t just have

Read More
background:url(images/plus.png)

as this is being enqueued onto header.php so i need to include this line below

$jquery_libraryurl = plugins_url('jquery_library', 'jquery_library').'/';

to output the whole url to the image. So I need to know how can I accomplish this. I have tried using style.php with this at the top <?php header("Content-type: text/css"); ?>

The only problem is I cannot use the line above calling the function plugins_url() as wp-load.php is not in the file and if I include it puts a big load on the css file.

So I am looking for a way to maybe output the css code with the variable above to a css file using php. I have looked everywhere and cannot find anything useful that may help me to accomplish this.

What are my options to do this and is there a way around this that is simple.

Related posts

Leave a Reply