I am trying to change the header image every “n” second/minutes. Have looked at a number of solutions on the web and am at present using the PHP code fragment below available at http://ma.tt/scripts/randomimage/:
It still only changes the image on a page reload not every ‘n’ minutes. I have also seen the post at:
How to rotate the header image per day?
However, I do not know how to adapt it to do what I want.
Could you please lend me some pointers on how to go about it as I am very new to PHP.
Moreover, would this be better done in JavaScript of PHP?
Thanks in advance.
To answer your question, in my opinion you would be way better using JavaScript. jQuery can be a great tool to do this. I would suggest installing the jQuery Cycle Plugin. into your theme. You can still load the images into your theme with PHP but if you want to change the image without needing to reload the page you’ll be best off using JavaScript.
Something like this:
Add jQuery and jQuery Cycle by adding this code to your functions.php
See wp enqueue script and Microsoft CDN for jCycle more info
Then add this to your header.php
There are other jQuery/JavaScript slideshows/cycle plugins but I think this will get you on the right track