Have you ever wondered how exactly you could choose which categories do and which don’t display your advertisements?   Maybe you have a Sponsored Review category and want to make sure that all posts filed in that category don’t display any ads.

This is something that you as a user of WordPress have the ability to do without to much effort.  What you need to do is paste the following code into your blog around your advertisement code:

<?php if ( !in_category(10) && !in_category(11) ) { ?>

This is your existing advertising code.

<?php } ?>

Where it says 10 and 11 you will want to place the number assigned to your categories that you want to censor advertisements from. You can repeat where it says ’&& !in_category(12)’ as needed until you’ve censored all categories.

Enjoy!

Want automatic updates? Subscribe to our RSS feed or
Get Email Updates sent directly to your inbox!
Tweet This | | Digg This | Stumble it | | Print This |

Kyle Eslick is WordPress enthusiast who took his passion for WordPress to the next level back in 2007 by launching WPHacks.com as a place to share hacks and review WordPress-related products.

There is 1 Response So Far »

  1. Todd Liebman says:

    Once I take an ad down from an individual category (which is being fed by AdSense) will I be able to place a new ad (not from AdSense) onto only that INDIVIDUAL category?

Trackbacks/Pingbacks »

Leave a Reply