Archive for the ‘Reviews’ Category

Smart Ads: small effort, potentially big ad revenue rewards

Wednesday, June 11th, 2008

I have seen a number of plugins that will allow you to manage every single detail of your Google AdSense ads and Smart Ads is not one of them. Its managing capabilities are minimalistic, perhaps even too much so for the novice user. However, it excels in a different area: smart ad placement. And that won me over.

In an ideal world the length of your posts is more or less the same and all of them are equally useful and related to the main subject of your website. In reality, well… you get my point. All the AdSense managers I have seen so far, despite their sheer wealth of options, do not take this into account. You can create the perfect ad or ads, but once it’s done it will be added to every post on your website, with few exceptions.

Smart features

Smart Ads allows you to:

  • specify a minimum post word count. Ads will not be shown on tiny posts, where they might take center stage and perhaps contain more text than the post itself. Not good!
  • show ads only on posts older than x days. Very useful to improve the relevancy of the ads shown, which in turn might lead to a higher click-thru-ratio.
  • exclude certain categories. Posts in these categories will not have any ads.
  • take into account images. If you intend to show the ad block inline and have your post wordwrap around it, then images can really mess up your layout since the don’t play nice with wordwrap. Smart Ads can look for images in the first x characters from the top and now show any ads if an image is found, preserving your layout.
  • disable ads for registered users. Imagine a subscription-based website, you can offer your subscribers an ad-free website.
  • decide on a per-post basis to disable ads.

Less user-friendly, more flexible

As mentioned earlier, a potential downside of Smart Ads is that you will have to do some of the work itself in getting it to actually display ads: no fancy manager. Here is an example from my own Smart Ads settings, which specifies how I would like to Adsense ads displayed at the top of posts:

1
2
3
4
5
6
7
8
9
10
11
12
13
//This advertisement will appear above your post content. You can surround it by any HTML you like (as shown).
$topad = '
<div style="float:right; padding: 15px 0 0 7px;">
<script type="text/javascript"><!--
google_ad_client = "pub-1419217250584397";
google_ad_slot = "2193850184";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
'; //leave this line

If that looks daunting, it really is nothing more than the code Google gave you when you specified how you wanted your ads to look, with the tiniest bit of HTML (in this case I specified that I wanted the ads on the top right of the post, with the text wordwrapping around the ads, with a little bit of padding in between).

While most people will be looking to use Smart Ads for Google AdSense, it will work just as well with Yahoo YPN, AdBrite or any advertising program. Just add the code you were given. In fact, you could even use them simultaneously.

Once the Smart Ads plugin has been activated and you have properly set up your Google Adsense code, Smart Ads takes care of the ad placement within your posts. You do not have to modify your theme files. If you like, you can specify an additional custom ad which is not governed by the rules you set out. You can add the ad at a specific point in a specific post or merge it into your theme or widgets.

Conclusion

Smart Ads may not have the looks but it certainly got the brains and in this case, that is worth gold - quite literally! Its weak point is really a strong point if you are interested in other advertisement programs and if you don’t, Google’s own Adsense wizards are more than capable of setting up the ads just the way you like.

My rating: 4/5
Versions: WordPress 2.5.1, Smart Ads 1.2

Syntax highlighting plugins

Monday, May 12th, 2008

Table of contents for Syntax Highlighting

  1. Syntax highlighting plugins
  2. Hacking the WP-Syntax plugin

One tool us programmers cannot do without is an editor with proper syntax highlighting features. As I will be regularly pasting code snippets on this website, I needed a plugin to do the same thing online to aid in readability. I’d like it to support multiple programming languages, show line numbers and allow me to overrule the default highlighting colors.

The Wordpress Plugin Directory contains a number of code highlighting plugins. I’ve limited myself to the most recent ones, which are certain to work with WordPress 2.5:

I have tried all three and will share my experiences with you.

Highlight Source Pro

This plugin is based on GeSHi (the Generic Syntax Highlighter). Code highlighting is done server-side, so JavaScript is not needed.

I’ve done a test run with this plugin, first with a XML snippet and later with a PHP snippet. I had hoped I could just slap a <pre> block in here and the plugin would pick up which programming language I was using, but unfortunately you will have to specify it yourself by setting the lang attribute. The class attribute can be abused to specify any number as your starting line number. There are no line numbers if you omit the attribute.

The result of my XML test was not satisfactory: it worked, but only the XML tag and the more common attributes like xmlns were highlighted. It should be able to do more with a well-structured XML document. The PHP test fared a lot better: although I didn’t care much for the default colors, my code was highlighted properly. The plugin is intelligent enough to add horizontal scroll bars when needed, which I much prefer over unspecificied line breaks.

WP-Syntax

Like Highlight Source Pro, WP-Syntax is also based on GeSHi. It should therefore work with the languages I use most of the time: CSS, HTML, JavaScript, PHP, SQL & XML.

I again did both tests and it probably comes as no surprise that the results were completely identical, as both plugins use the GeSHi engine. WP-Syntax also supports line numbering, although it uses its custom line attribute instead of HSP’s neater class solution. If you care about XHTML validation, that you should probably skip WP-Syntax or avoid line numbering. I prefer WP-Syntax’s default layout for code snippets over HSP’s.

An issue I ran into that affects both plugins is that WordPress will seriously mess up your code snippets if you dare to use the visual editor. We will have to find a solution for that.

WP Chili

WP Chili is based on Chili - the jQuery code highlighter. Unfortunately I can be very brief about this plugin: it does not work for me at all.

The same two tests once again: XML was not recognised. My PHP example fared slightly better but it did not yield a nice looking code snippet, it looked rather like a <p> tag with color formatting. It did not add horizontal scroll bars when needed. I couldn’t get it to work consistently: a few times it worked, most of the time it did not.

Conclusion

The choice is between Highlight Source Pro and WP-Syntax. There is little difference between the two. Neither does exactly what I want. It should be noted that WordPress plays havoc with code snippets if you use the visual editor. It is dissapointing that neither plugin offers a solution for this problem.

Out of the two I picked WP-Syntax. I will have to make some modifications anyway and WP-Syntax’s default layout is more to my liking. To be continued!