Welcome to MoneyMakingStudent.co.uk

How to Display Matched.co.uk Adverts on WordPress Blogs

matched.co.uk php code
photo by totalAldo

If you’re afraid of PHP code or don’t know what a widget is, run away. This is really a follow on post from my introduction to matched.co.uk. The problem with matched.co.uk is you have to submit absolute web urls. This is fine if you are going to drop the ad code into the main body of the page, say at the bottom of your about page. But this may disrupt the appearance of your blog. Ideally you would like to put adverts in your sidebar, but the sidebar is displayed the same on every page/post. This is where a little PHP code saves the day.

What you will need:

  1. First we need to install and enable the Exec-PHP plugin if you don’t already have it installed. This allows you to execute PHP code within posts and more importantly to us within widgets.
  2. Once signed up with matched you will have to give 5 urls, I reccomend your home, about and contact pages plus two others, for example it could be the second and third pages of posts, or a specific category.
  3. Once allocated ads, I took the HTML code for each ad and pasted it in a separate Notepad file. (you could also use the PHP code given I think) Just make sure all the ads are the same size, I stuck with 125*125.
  4. Rename the files so they are memorable, e.g. aboutads.php and contactads.php Then upload them to Exec-PHP’s includes folder. (WP installation directory–>wp-content–>plugins–>exec-php–>includes)
  5. Create a new ‘Text’ Widget in wordpress (Design–>Widgets) and insert the following code, editing where necessary.
  6. <?
    switch ($url) {
    case "www.yourblogname.co.uk/":
    include ("indexads.php");
    case "www.yourblogname.co.uk/about/":
    include ("aboutads.php");
    include ("sidebarads.php");
  7. The second line of PHP code detects the current url, depending on which url is being viewed, the code will insert the advert code to match, if it is not one of the defined urls it will use the default, which I have called sidebar.php, without this, the code will malfunction. Therefore it is essential to create a default ad. For this I made one up for another affiliate program, or you could insert an ad for something else maybe pointing at a post on your site, or even sell the ad space!
  8. To add more ads you need to insert the code below over and over again for each url you have with matched.co.uk:-
    case "[Insert url here (no http://)]":
    include ("[name of file containing ad code].php");

Thats all there is to it, may not be perfect PHP code, but I’m no expert in that sort of thing. This is just my method for displaying matched.co.uk adverts.

Hope that helps,


Be Sociable, Share!
Tweet This!

2 Comments, Comment or Ping

  1. I am waiting for the matched people to get me ads and was wondering how to add the ads in different pages.. This was what I was searching for.. Will try this out when I get the ads.. Thank you..

    xenaltos last blog post..EntrecardersÖAttention!!

Reply to “How to Display Matched.co.uk Adverts on WordPress Blogs”

CommentLuv badge

Keep Updated:

Follow Me on Twitter Subscribe via Email Subscribe via RSS

Twitter links powered by Tweet This v1.8.1, a WordPress plugin for Twitter.