Daily Archives: September 10, 2007

WordPress MU 1.2.5

A new release of WordPress MU, the multi-user, multi-blog version of WordPress is now available.

This is a security release to address issues brought to our attention by Alexander Concha who I must thank for his unfailing patience while we sorted out this release.

Edit: this release is based on WordPress 2.2.3. Unfortunately a last minute bug crept in where post titles looked like post slugs when viewed on your blog. I quickly rolled together a new minor release, 1.2.5a which has an updated wpmu-functions.php. The download page has been updated too. If you have already updated your install, all you have to do is go to this page and download a new wpmu-functions.php and place it in your wp-includes directory. Apologies for the mix up!

Edit 2: I forgot to mention yesterday that a lot of the functions that were in the files in mu-plugins/ have been moved into wp-includes/wpmu-functions.php so move those files out of the way if you get errors about functions already existing. As stated previously on the forum, kses.php is synced with the one in WordPress which means class and id will be stripped from posts. If you’re happy for your users to use the class and id tag attributes then the following function will come in handy. Put it in mu-plugins/kses.php where it will be activated automatically.

function addabitofclass( $tags ) {
    global $allowedposttags;
    foreach( $allowedposttags as $tag => $attr ) {
        $attr[ 'class' ] = array();
        $attr[ 'id' ] = array();
        $allowedposttags[ $tag ] = $attr;
    }
    return $allowedposttags;
}
add_filter( 'edit_allowedposttags', 'addabitofclass' );

The observant among you will notice I forgot to assign the result of the filter in wp-includes/kses.php. This has since been fixed but it was too late for this release. Making it a global in the function above was a suitable work around.

Friends don't let friends see adverts

This post has been a long time in the writing. Ever since I started advertising on my blogs my strategies have been tweaked continuously so consider this post a snapshot description of what I’m doing with Adsense advertising now. This is a long post, but read through it. The plugin I use to do most of this stuff is linked near the end.

Last year at the IT@Cork Web 2.0 conference, Gavin mentioned that he earns enough off his blogs to pay for his hosting, and I thought to myself that it would be handy to have an extra bit of cash to do likewise. I didn’t do anything about it until July when I signed up for an Adsense account and put some ads on the site. Things were slow that month but they’ve steadily improved to the point that it’s a reasonable second income now.

At last year’s WordCamp in San Francisco, one of the talks was about monetizing your blog. It was a fascinating talk with a great discussion afterwards and I brought home some good ideas:

  • Don’t show adverts to your friends. They are the people who visit your blog and leave comments. They’re not going to click the ads anyway.
  • Position matters. Right underneath the post title and above the content is the best place on a blog to put an advert. (Thanks Matt!)
  • Go as wide as you can.
  • Experiment with ad colours, borders and sizes. Don’t accept the Google defaults. Blend your ads or make them stick out. It all depends on your blog.

Since then I’ve developed my ad serving strategies further:

  • I love when people comment, and I’m honoured when people subscribe to my blog. Therefore I won’t show my RSS or email readers adverts. If you like what I do enough to subscribe I won’t burden you with advertising. You’re my friend.
  • Don’t show adverts on the homepage.
  • Adsense Injection is great for putting adverts directly into posts.
  • Monetize your archive. Any post older than a month gets adverts.
  • Don’t show adverts to Digg, Delicious and Stumbleupon visitors.
  • Identify where most of your “just passing through” traffic is coming from and show them adverts, except for social bookmarking websites of course.
  • If my blog showed you adverts, I’ll tell you “Don’t like adverts? Leave a comment and they disappear.” below the comments form. At least one person has commented favourably about that.
  • Fill the competitive ad filter with low paying URLs. If you’re still showing ads from helium.com then you’re missing out. If your daily eCPM isn’t at least $5 you’re not making the most of your advertising. Subscribe to notspam.org to see which MFA and low paying sites go into my competitive ad filter. I’ll talk about the competitive ad filter in more detail in a future post.
  • Set an hour long cookie for users from search engines. Blogs have a notoriously low attention span for most visitors but if they click to the front page, show them a few more ads.
  • I use Kontera too but the returns from that have been very disappointing. One of my posts has an AuctionAds unit in it. You’ll see that no matter what because I’m testing it for a few weeks and the post in question is almost always only hit by visitors from Google.

I run advertising on my photoblog, In Photos dot org too but the rules there are a bit different:

  • Each post has a big image, pushing the text description below the fold. That’s not ideal for displaying adverts so I use the left sidebar to show a 600px high Adsense skyscraper unit.
  • Show the sidebar advert even on the homepage. It’s not an ideal location so better give it as much exposure as possible.
  • It’s difficult to attract visitors to a photoblog. I wrote 11 seo tips for your photoblog to outline some of the ways I draw traffic in. The biggest mistake is definitely not writing about your photography. If there is no text, how can the search engines figure out what your blog is about?

I’m not the only one only showing adverts to selective visitors. Recently Ben Gillbanks had a great post on increasing Adsense earnings that says some of the same things I summarised here.

I haven’t tried it yet, but the who sees ads plugin from Ozh does most of the same checks I do. That plugin won the WordPress plugin competition so congratulations to Ozh on winning!

The No Adverts for Friends plugin

Announcing my shiny new, rough as anything No Adverts for Friends plugin! This plugin adds new commands that you can use in your templates. Use them to surround your Google Adsense or other advertising code.

The No Adverts for Friends API:

  • is_regular_user() – returns true if the visitor has left a comment or is logged into your blog.
  • is_whitelisted_site( $url ) – returns true if $url is in a pre-defined list of friend sites like Digg, Delicious and StumbleUpon.
  • is_old_post() – returns true if the current post is over a month old.
  • is_searchengine_user() – if a user comes from one of the listed search engines or this is an old post return true.

Each of the API calls depends on the one before it returning a favourable value. For example, is_old_post() won’t return true if is_regular_user() returned true, no matter how old the post is.

Example usage:
<?php if( is_searchengine_user() == false ) { echo "Google adsense code goes here"; }?>
Edit single.php in your current theme and add that code somewhere within the loop. Now either visit an old page on your blog or use a Google search query to bring you to your blog. Hopefully you’ll see the text “Google adsense code goes here”. Replace this text with the Google Adsense Javascript.

Download

Install

  1. Rename both files to .php and place friendsadverts.php in your plugins folder. If you use WP-Cache copy wp-cache-phase1.php into plugins/wp-cache/ overwriting the file already there (make a backup first!)
  2. If you use WP-Cache copy the $nevershowads and $passingthrough arrays from friendsadverts.php into your wp-config.php. They’re needed by WP-Cache which kicks in well before plugins are loaded.
  3. Activate the “No Adverts for Friends” plugin from your plugins page and modify your templates using the new API.

Well, you’ve read this far. If some of the advice in this post helps you, if you like this plugin, if it improves the user experience of your regular visitors and maybe even increases your advertising revenue please consider uncommenting the add_action() command at the start of friendsadverts.php. The donnchas_happy_happy_notice() function prints a message in your blog’s footer saying you use this plugin and links back here.

Thanks John for bugging me to write this up. Hopefully I’ll see you at next year’s WordCamp!