Updated: How To Create a Random Banner Ad

I have got a fun tutorial for you to try this weekend on your blog! A while ago I did a tutorial on creating a header ad banner and judging from my Google Analytics it was very popular so I thought I’d turn it up a notch and making an updated version which changes on refresh! On the desktop version of this blog, TheFashionTechnologist you will see ad banner at the top of the page, if you refresh the page you will see another ad. I have three in a rotation, a Missguided, Topshop and Net-a-porter one.


If you would like your banner ad to change on refresh like this, add the following code to your theme (WordPress Only) functions file or if you are cool, to your custom functions plugin.



Then replace all the PASTE AD HERE with ad’s. If you use an affiliate network like rewardStyle then paste in the banner code in this space.


This random ad banner function has three ad’s in it, to add another simply paste in another:



When happy, open up the file where you would like your ad banner to show, for example to place it at the top of your blog then open header.php and just below the tag paste in the following (if you are struggling with where to paste it, see this tutorial!):


(uses inline styling)



That’s it! Pretty straight forward once you know how huh?

chloe-signature