Reply To: Reference image field in css?
Support › General › ✅Reference image field in css? › Reply To: Reference image field in css?
November 13, 2018 at 9:52 PM
#11932
Keymaster
To get the image URL, you have to use PHP. So in this case, it's impossible to put the image URL directly in CSS file. However, you can use PHP to output CSS. Here is a sample code:
$image = rwmb_meta( 'mobile_image' );
if ( $image ) :
echo '
@media (max-width: 767px) {
.page-hero .product-page-hero {
background-image:url(' . $image['url'] . ');
}
}';
endif;