Display Random Header Images in WordPress
Posted by Susan Tyson on 08 June 2016 05:58 PM
Most blog designs get boring if they have a huge header picture and it is static. This is when this tutorial comes in to make your header images dynamic because it rotates on each visit. You can select as many images as you want to rotate randomly. It brings life to a blog.
First you need to name your images in this format:
You must separate the name with an underscore. You can change the headerimage text to himage or anything you like.
Once you have done that paste the following code in your header.php where you would like the images to be displayed or in any other file.
Make sure that you change the number 3 if you decide to do more than 3 images. This code is not exclusive for WordPress, it will work with any php based platform.