Creating AdSense Widgets in WordPress

technology — Tags: , — boredandblogging @ 1:00 am

Recently I attempted to create a WordPress widget for an AdSense Firefox referral image ad in a widget-ready theme. I was quite surprised how easy it was. It may not be the best code ever, but it got the job done. Here is a quick run-down of how I did it.

Assuming you already have the Google AdSense unit code, create a file like <root directory>/wp-content/themes/<specific theme>/widgets/ff_ad.php and put your unit code in it. You will probably have to create the widgets directory under your specific theme. So the AdSense code in ff_ad.php should look something like this:

ff_ad1.png

Then in the <root directory>/wp-content/themes/<specific theme>/function.php, add this:

functions.png

At this point, the widget should show up in the list of available widgets for the theme.

Thats it.

0 Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2008 bored and blogging | powered by WordPress with Barecity