Random text or images (or random anything else)

How can I have a photo, some text, links or anything else changing on pageload so every time the page is reloaded the image or text changes randomly?

Chapter 1: Random
Chapter 2: Random with refresh button

Chapter 1: Random

Try reloading this page a few times and you will see that this photo here will change at random or shuffle each time you reload the page...

Same for this text:

Of course the more possibilities you add in the code the higher the probability it will display something else every time the page is loaded.

Having a photo, some text, links or anything else which changes every time the page is loaded is really easy. The good thing is that to visitors visiting your website from time to time it will look like you updated the website since the last time even if you didn’t. For more regular visitors it’s nice to have something changing from time to time. Also you can use it to point people to different pages randomly since every image can be linked to a particular page if you want (different photo galleries, pages you recently updated and more).

How this is done and how to add it to your theme is described in my WPFAQ.org E-Book (sample)

Chapter 2: Random with refresh button

This example here features mixed contents and a Refresh button. Instead of only displaying other content when reloading the page this also displays different content when hitting Refresh without reloading the entire page.

How this is done and how to add it to your theme is described in my WPFAQ.org E-Book (sample)

This FAQ is also discussed in my WPFAQ.org E-Book (sample)

© WPFAQ.org - Tutorials, Tips & Tricks is made with WordPress and for WordPress.
It's an EBookStoretoday.com company. It’s presented by Cédric Giger and hosted by HostGator.com
Thank you for visiting and supporting my website,
- Cédric -

Now share it…

Share

Comments are closed.