how can I change css of a div displaying some text on my home page from the admin are. I want when I enter a color code in my plugin admin page, the code is updated in the css file. This is a common thing, but can't get a grasp of it.
so here is the css of my div.
#div{
background: #0000;
}
and here is the php code for my admin section.
<?php
Background Color: <input type="text" size="20" name="background"
value="<?php get_option('backgroundchanges');?>"/>
so basically I want the value that I enter in the input to be reflected in the css file.
thanks for any help.
regards, :)
-ROn.
You should actually not use a .css file and instead use a .php file acting as a .css file. Then you can just set the new color to a variable in the .php css file.
Rename your style.css file to style.php, then add the following to the top of the file:
<?php header("Content-type: text/css"); ?>
This line tells the browser that the file is CSS instead of HTML. In your HTML files, change the stylesheet references from style.css to style.php. For example:
<link rel="stylesheet" type="text/css"
media="screen" href="style.php">
citation: http://www.barelyfitz.com/projects/csscolor/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With