Easy Way For Advertisement In WordPress

Since version 2.5 WordPress introduced the shortcode API, more detail about it in our article „WordPress Shortcode API“. Recently I had a task which is surely common, but with the help of shortcode API and custom fields very easy to solve. I had to include some advertisements (in german: Werbung) into some articles.

In each article the editor puts 3 custom fields: bild (image), link, linktext. In the text he can set the shortcode [ad]. This shortcode will be recognized by WordPress with the help of the following function. It will also load specific data to display the ads here.
Continue reading …