/ Published in: PHP
Do not forget to name images you want to use for background like 1.jpg, 2.jpg, 3.jpg etc.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
html, body { height: 100%; } img#bg { position:fixed; top:0; left:0; width:100%; height:100%; } <body> <img id="bg" alt="" src="<?php bloginfo('stylesheet_directory');?>/images/<?php echo $random_image; ?>.jpg" />