In the previous recipe, I have shown you how to add Google Adsense ads to your blog by pasting them in your theme files, or by using a text widget. However, there's another really interesting option—being able to display ads anywhere on your posts by using a WordPress shortcode.
Introduced in WordPress 2.5, shortcodes are powerful, but yet are quite unknown WordPress functions. If you use forums such as phpBB or Vbulletin, you're probably familiar with the use of shortcodes, for example, to display an image. A basic shortcode looks like this:
[img]http://www.wprecipes.com/wp-content/themes/wprecipes/images/cat.png[/img]
As you can see in the preceding example, shortcodes let you use features such as inserting an image without having to use any HTML.
While this is very useful for people who don't know the HTML language, shortcodes can be used to achieve much more. In WordPress, they can be used, for example, to...