May 18th, 2011 - By Bowo

Yesterday I promise you about Simple Random Images PHP Script using for header background, like you can see some of site that using wordpress have interesting header, the header can rotate/showing random image everytime you refresh the page. There is some way to do that trick, but right now I will share using almost same method like post before.

Now all we have to do is your image list for the rotator (min 2 picture, max upto you), rename it with number (exp: 1.jpg, 2.jpg, 3.jpg etc) and put inside image folder under your themes folder, for example (http://www.site.com/wp-content/themes/themes-name/images/) and for the code, try to open header.php and find the header code (this maybe different on each themes)


<div id="header"></div>

And replace/change to be like this


<div id="header" style="background-image: url(<?php bloginfo('stylesheet_directory'); ?>/images/<?php echo(rand(1,n)); ?>.jpg);background-repeat: no-repeat;background-position: center top;"></div>

Like u see the code almost same like the older post, and for explanation you can read again in this post. (sorry on meeting right now can’t write to much :P )

Save and refresh ur site few time and see what happen.

wp