I want to change the background color with a background image in my plugin. While selecting the radio button in wordpress. when changing the color of the div it should update the css file.
I want to update
.wrap_div{
background:#9CF;
float: left;
width: 584px;
}
the div style with the below one.
.wrap_div{
float: left;
width: 584px;
background-image:url(./images/back2.png);
}
How can I make changes in my css file. Any help is appreciated.The wrap_div is a user side div.I am using this code in admin side and I want the changes should appear in user side.
You can change the element to another class,changing css file is really not a good option,speaking from experience…
You can inject the style in your document
<head>
directly using thewp_head
hook.create a php file with css structure which you will update from server and import it in your style.css with
@import 'css/style.css.php?c=1';
Your php file should look like this:
update your css file by
And use this script
You want to use following code.
Also add other css style like this using .css.
By using JavaScript, you can try something like this: