Make Firefox Pink for October with PinkHope.

Customize AuctionAds Per Post via Wordpress Categories

AuctionAds LogoNot long ago I was introduced to AuctionAds, a systems that displays Ebay ads in a nice and clean format on blogs. The upside is that they look great, are easy to use and give another form of monetization abilities to a blog. The downside was that they were not content specific.

There is an article out there on how to Make Auction Ads Contextual but it works with the Ultimate Tag Warrior plugin. What I was looking for was a way to tie the ads into the categories, so I coded it out. Here is how you can customize your AuctionAds to be category specific with Wordpress.

The firs thing you’ll need to do is create the code for your AuctionAds and place it where you want in your blog. Then we’ll update the auctionads_ad_kw line to:

auctionads_ad_kw = "< ?php $cat = get_the_category(); $cat = $cat[0]; echo $cat->cat_name; ?>”;

Now, when the AuctionAds render on the page, they’ll pull the first category and use that as the keyword to base the ads on.

If you’re like me, and your first category is always the same (General in my case) you can pull the second category instead.

auctionads_ad_kw = "< ?php $cat = get_the_category(); $cat = $cat[1]; echo $cat->cat_name; ?>”;

Now, if your categories are General & Software, AuctionAds keyword will be Software.

What I came to realize next was that a some of my posts are old and came from an old Blogger blog. Those don’t have any categories associated with them so no keywords would get rendered and thus the AuctionAds would be left blank. However that’s an easy fix.

auctionads_ad_kw = "< ?php $cat = get_the_category(); $cat = $cat[1]; echo $cat->cat_name; ?>,software,apple”;

Now, if there is no category associated with a post, the keywords will be software and apple. This will help ensure that no matter what, AuctionAds will show.

With this minor edit to the AuctionAds code, you can bring your ads one step closer to being content targeted. This is especially necessary for a blog like mine where the posts cover a wide range of topics.

Important Note: In order for the raw code above to render correctly in a Wordpress post, there is a space between the < and the ?php code. This space should be removed when adding it to the source of any php files.



Tags: , ,

No Comments      

Leave Your Thoughts

Some comments may be held for moderation and not appear immediately. Those with links and/or harsh language may need my approval before showing up live. I may also remove or edit any that I feel are spammy in nature or just plain rude.

Subscribe without commenting


Plurk.com
TwisterMc Themes For Firefox 3 Connect with me via a social network. Web Host
Apple iTunes
Tumbler Badge
Archives
In Expensive Quality Stock Photos Made on a Mac