Warning: count(): Parameter must be an array or an object that implements Countable in /home/chris493/public_html/wp-includes/media.php on line 1176
Random Hero Image from Directory for WordPress and Genesis – Christina Creative Design
Christina Creative Design

Random Hero Image from Directory for WordPress and Genesis

Warning: count(): Parameter must be an array or an object that implements Countable in /home/chris493/public_html/wp-includes/media.php on line 1176
alt="Random Image Blog Post Image" width="800" layout="responsive" height="378">

This is a Google AMP optimized post. View the original: Random Hero Image from Directory for WordPress and Genesis. Google AMP is new technology and this post may contain tutorials with content you can't see unless you view the original, mobile page.

If you’d like to create images for a hero section of a website and put those images in a directory and have them appear as random background images that change each time a person visits a page, this is how you do it with WordPress. The more images you have, the more random it is.

If this saved you time, and I’m sure it did, consider a donation via PayPal to me@christinacreativedesign.com.

This gist has two sets of code. The first is the CSS is which is an example only. The next file is the random image php from a directory for Genesis (modifiable for any WordPress theme). Adjust as needed for your requirements.

Post Navigation

Previous:


Warning: count(): Parameter must be an array or an object that implements Countable in /home/chris493/public_html/wp-includes/media.php on line 1176

Warning: count(): Parameter must be an array or an object that implements Countable in /home/chris493/public_html/wp-includes/media.php on line 1176

Warning: count(): Parameter must be an array or an object that implements Countable in /home/chris493/public_html/wp-includes/media.php on line 1176