Amit Bhawani Blog

Stay Updated!

Powered by Genesis

You are here: Home / Wordpress Guide / Show Advertisements based on Wordpress Blog Categories

Show Advertisements based on WordPress Blog Categories

January 9, 2010 by Amit Bhawani

I have a WordPress blog where i write reviews on different products and services ranging from web hosting, gadgets, mobile phones to digital cameras. Iam currently planning to setup affiliate links and banners in my blog because now i have got excellent traffic who visit my blog daily searching for reviews and i want some kind of setup in which i can display different advertisements for each category on my blog. Is there any possibility for this kind of system like any paid wordpress plugin or any php codes etc. Question by Ranjith who runs a high ranking wordpress based blog.

Targeted AdvertisementsSolution : WordPress is one of the most flexible Content Management System which can be used to develop a blog, shopping portal, jobs portal to a static looking website. Overall you can customize it in anyway by just finding the right links which can help you in setting this up. You can use different plugins in wordpress in order to show the advertisements on different locations of your blog but there seems to be no plugin which can help you in showing different ads on different categories.

Hence, its recommended to tweak into the Category Function of WordPress and tweak it so that you can show ads on different sections. Located at – http://codex.wordpress.org/Template_Tags/in_category , you can get a code as follows :

This wordpress function is going to use the if function and search for the Category ID and display the advertisement whenever found. You just need to add the ad code in between the following code and then add the whole code in your theme files.

<?php if ( in_category('category_id') ): ?>
// Your Category Specific Ad Code here
<?php endif; ?>

This way you can display content or category related advertisements on your blog instead of running the same ads on the whole blog. Do check out a similar article which can help you in showing ads on homepage of wordpress blogs. Let us know if you have any other queries regarding this.

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook

Related

About

My name is Amit Bhawani and here I like to share my internet/tech experience with my online readers. You can follow me on Twitter, Facebook & Instagram at @AmitBhawani I am also the Editor-in-Chief of PhoneRadar & Master Gadgets

About Amit Bhawani

My name is Amit Bhawani and here I like to share my internet/tech experience with my online readers. You can follow me on Twitter, Facebook & Instagram at @AmitBhawani

Comments

  1. Rajesh Merchandani says

    January 10, 2010 at 3:10 am

    As far as the ad content goes – have you looked into Google Ad Planner ?

    I have just started setting mine up today, so I can’t tell you much about it yet – just that it seems to look promising.

  2. Arif Nezami says

    January 10, 2010 at 8:32 am

    Thanks, I’ll start doing it, from now on..

  3. Cebu Rocks says

    January 10, 2010 at 5:03 pm

    now this one is very useful! I should try this…

  4. Prasanth Chandra says

    January 11, 2010 at 4:39 am

    Will there be any difference if we show ads based on categories? I tried this once but never noticed a change.

  5. nik says

    July 2, 2012 at 11:35 pm

    thank you very much..just looking for the same.
    btw I was wondering if there is any plugin which could help me targeting adverts country-wise.

Timeline

Check out Just EV Tweets by @amitbhawani

Recommended To Read

  • How to Find your WiFi Signal Strength & Dead spots in your Home – Best Apps
  • The Wuhan Corona Virus Effect in India – How to Stay Safe
  • This Blogger Lost 25Kgs with this Secret Strategy that Includes a Fitness Tracker
  • Making Money on YouTube, MCN, Useful Tools, Tips & Success Stories
  • The #JaguarPerformance Experience that was Mind Blowing