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 | Add to Del.icio.us | | Print This

Kyle Eslick

Kyle Eslick is the founder and primary author of WordPress Hacks. You can learn more about him at KyleEslick.com or you can follow his personal tweets here.

Be The First to Comment! »

Trackbacks/Pingbacks »

Leave a Reply