Category Archives: Computer Science

Add Some Randomness to Your (WordPress) Website

Every time you refresh the page, this picture of the book(s) will change:

 

Install a wordpress Plugin called (PHP Code for Posts)

Then, write a simple program which randomly generates a number, then displays a certain line of code (for a picture) into the spot where you want you random pictures.

I do this on my about page and a couple of other places, where I have a few pictures, all of which will work.

Here’s the PHP code (sorry, it’s an image, I’m trying to figure out how to run and display php on the same page):