No Adverts for Friends

Plugin Status Stable
Author Donncha O Caoimh Version 0.1
Plugin Home Visit Author Homepage Visit
Download Visit Plugin License N/A
Description :
Don't show adverts to your friends


This plugin allows you fine grained control over who seems adverts or any other bit of html or Javascript code on your blog. For a more detailed discussion on how it’s used, read my Friends don’t let friends see adverts post.

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:

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.

Similar Plugins

Leave a Reply