If you are a blogger who covers various topics under different categories and uses ad networks like Google Adsense, then you may sometimes want to remove ads from certain post categories.
So here is the code ( thanks to Keith and John ) which lets you remove ads from certain categories in WordPress:-
<?php
if ( !in_category(5) && !in_category(10) ) {
?>
Your ad code here
<?php } ?>
In the above code, the number in brackets is the category id.
Finding Category ID in WordPress 2.5
If you are using WordPress 2.5 then to find the category id, just go to manage categories and then hover your mouse over a particular category and look at your browser status bar. You can find the category ID there.

And thats how you find the category id in WP 2.5 . We hope this technique helps you to manage ads on your blog in a better manner.
Abhijeet Mukherjee is a blogger & web publisher. This is his personal blog about blogging, productivity, internet marketing, social media and other random stuff. 

