I’m trying to specify a background image in a style in a plugin I’m making. I was just outputing tags from the php, but realized I should probably be using enqueue_style… But how do I put a line of code like this:
.star.half {
background:url(<?php echo plugins_url(); ?>/my-plugin/images/star-half.png) no-repeat 0px 0px;
}
Into a plain .css file? What do I put where it says <?php echo plugins_url(); ?>
?
Just add a STYLE tag in
'wp_head'
.Add this in your
functions.php
. Don’t stuff too much CSS in it, just the dynamic bg image you need.It’s not the easiest thing to create a dynamic CSS file so, just for a bg image, use this method.