- I'd like to set a random background-image into a
<div>Container</div>- To keep it simple I installed a plugin using [shortcode] to display random images. This works fine.
- How to get the shortcode
[wp-image-refresh]working together withbackground-image:url(...) - I tried it even as inline-style with no result.
This is what I have:
HTML
<div class="header_random-image">
<div id="hero"></div>
</div>
CSS
#hero {
background-image: url('<?php echo do_shortcode("[wp-image-refresh]"); ?>');
background-size: cover;
background-position: 50% 30%;
height:70vh;
width: 100%;
margin-top: -65px;
}
Another try with no result: Inline-style
<div class="header_random-image">
<div style="background-image: url('<?php echo do_shortcode("[wp-image-refresh]"); ?>')"></div>
</div>
Could anybody be so kind to help? Or does anybody has a simple solution to place div-random-background-images?
Best from Berlin
url("<?php echo do_shortcode('[wp-image-refresh]'); ?>");- Andy Holmesadd_filter( 'widget_text', 'do_shortcode' );- tao<style>tags in your<head>tags insideheader.php, just a question if not that could be your answer - Colin Gell[wp-image-refresh]as a plain shortcode in apostand, tell use what it outputs on the front end :) - Colin Gell