Nick Shaw

Display a Random Header Image on Your WordPress Blog

Upload some images named 1.jpg, 2.jpg, 3.jpg and so on to your your wp-content/themes/yourtheme/images directory.

Open header.php and paste the following code in it:

<?php
$num = rand(1,10); //Get a random number between 1 and 10, assuming 10 is the total number of header images you have
?>
Exit mobile version