CSS background images inside PHP plugin file
-
I’m trying to use CSS background-image url(”) link in my WordPress plugin php file. None of the images are showing and I’m not sure how to make it work. It’s for a client so I need the images to be able to be installed along with the plugin, not manually placed anywhere in the theme folder.
I’ve tried putting images in the theme folder but it still doesn’t work. I’ve tried linking to the url by storing it in a variable ($url).
php:
$url1 = ‘image.png’;css: (in same php document)
.ch-img-2 {
background: white url(‘<?php echo $url2 ?>’) no-repeat;
background-size: contain;
background-position: center;
}also tried:
.ch-img-1 {
background: white url(‘<?php image.png ?>’) no-repeat;
background-size: contain;
background-position: center;
}
The topic ‘CSS background images inside PHP plugin file’ is closed to new replies.