Random content PHP

Ever needed to display content randomly? Perhaps a random image, a random quote, or even a random WordPress post. There’s a very simple way to do this.

Create a PHP file where you will store or reference your content. You can reference images, text, whatever you like.

Upload the file where your theme is. To reference it, just so a simple PHP include. This is easier to maintain then repeating the same code across multiple template files. You can see the above code in action in the footer of my site, the quotes are courtesy of rap legends Kanye West, Eminem and Tupac Shakur.