Show different ads on different categories

You may be “better off” doing this with Javascript, or maybe jQuery if you like.

For example, the class in a topic shows the name of the category like this example:

<span class="category-name">UNIX for Beginners Questions</span>

So, in a script for the topic page, you would select the text for the class “category-name” and then inject your ad tag into the div element of your choice based on your category text.

This is, in my view, a better method that hiding and unhiding div elements of ad code tags based only on CSS.

This is also very easy to implement for anyone who has basic Javascript or jQuery skills

You select the inner text of the span element based on the class of the category span. You then match that inner text against your category list and insert your ad code into the DOM element of your choice on that page based on the category.

It’s pretty simple for anyone with basic Javascript skills to write this code and it’s also probably the best way to do what you are wanting to do. @Windsooon