El blog de Daniel Muñoz “No hay mayor riqueza que el conocimiento ni mayor pobreza que la ignorancia.” – Alí ibn Abi-Talib

27may/090

Selective Adsense – WordPress Plugin

[Versión en Español]
This plugin is based on Adsense Deluxe and Whydowork Adsense plugins.

I liked the Adsense Deluxe option to put comments inside my posts to be replaced by the ads, so I could control the best places for the ads. The problem with it was the max-3-blocks and max-3-links per page impresion. Adsense Deluxe didn't distinguished between them and would print them all (in pages like home page where there is one post below another).

So I wanted to control that only 3 ads of each category would show on each page impression.

Whydowork Adsense would show only 3 per page, but it didn't distinguish between categories neither let me choose where in the post to place the ads. Only top, middle and bottom, and the alingment.

With Selective Adsense (my first plugin ever), wich I developed following the Whydowork Adsense plugin code, I can control where in the post the Ad will display, the alignment (left, none, right) of it, and which Ad. I also can make it choose randomly which Ad giving it a list to choose from. With the posibility to give more probabilities for some Ads.

Selective Adsense also let me give it a list of probable alignments to choose from. And also allows a php tag to put Ads on templates, giving a list of Ads to choose from (it doesn't support alignments on php tags).

This could containg bugs or security holes, but I provide it "as is". And I wait for your suggestions, comments and bugs/security holes reports.

Usage:

Inside Posts:
Insert this html comment:
<!--SelectiveAdsense(3,1,1,2,3,1)[1,3,2,3,1,3]-->

The comment will be replaced by the Ad. Wich Ad? Three probabilities for Ad#1, one for Ad#2, two for Ad#3 (3,1,1,2,3,1). Aligned how? Two probabilities for left, one for none and three for right [1,3,2,3,1,3].

It replaces until three ads of the same category (Block, Link or Ref) are shown. After that, comments for this cagegory are replaced by null string. The other categories continues to be raplaced.

On Template:
Insert this php function: SelectiveAdsense('4,1,1,2,3,1');
The Ad will be shown at that place as is (no align, nothing). Three probabilities for Ad#1, one for Ad#2, one for Ad#3 and one for Ad#4.

Supporting more Ads:

If you want more than 20 Ads, you can change this value on the code:
$MAX_ADS=20;

Download plugin.

http://www.danielmunoz.com.ar/blog/2009/05/27/selective-adsense-wordpress-plugin/

Comentarios (0) Trackbacks (1)

Deja un comentario