Title: Adding sidebar widget only for certain categories
Last modified: August 19, 2016

---

# Adding sidebar widget only for certain categories

 *  [geoffcj](https://wordpress.org/support/users/geoffcj/)
 * (@geoffcj)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/adding-sidebar-widget-only-for-certain-categories/)
 * I have a personal site, based in wordpress, that I post on a variety of topics.
   For one topic, I also run a NING site on the same topic.
 * I’d like to figure out a way, where for my WordPress site, I can have a widget
   appear in the sidebar to “advertise” the NING site, but only for posts in one
   category.
 * Any suggestions?

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [macondo](https://wordpress.org/support/users/macondo/)
 * (@macondo)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/adding-sidebar-widget-only-for-certain-categories/#post-1042655)
 * Hey GeoffCJ,
 * I stumbled upon your message while looking for the exact same thing you are looking
   for, namely the ability to display widgets only at certain conditions.
 * I think I found a solution here:
 * **Slayer’s Custom Widgets v1.0**
    [http://www.thaslayer.com/2008/10/16/wordpress-plugin-slayers-custom-widgets-v-10/](http://www.thaslayer.com/2008/10/16/wordpress-plugin-slayers-custom-widgets-v-10/)
 * Good luck!
 *  [alanft](https://wordpress.org/support/users/alanft/)
 * (@alanft)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/adding-sidebar-widget-only-for-certain-categories/#post-1042656)
 * another solution:
 * [http://wordpress.org/extend/plugins/widget-logic/](http://wordpress.org/extend/plugins/widget-logic/)
 * by me 🙂
 *  Thread Starter [geoffcj](https://wordpress.org/support/users/geoffcj/)
 * (@geoffcj)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/adding-sidebar-widget-only-for-certain-categories/#post-1042662)
 * Alanft,
 * Thanks. Hopefully you’ll see this, but I installed your plug-in and I’m still
   having trouble getting the logic to work.
 * If you look at my site, [http://kimandgeoff.com](http://kimandgeoff.com) , I’ve
   got a Category “Kayak”. I installed your widget, and used the logic is_category(
   Kayak) to display a link to my Ning site. It shows up when you click on the category
   Kayak, and not elsewhere, so I’m partway there.
 * I’m trying to write the logic statement to make it appear there, or in the sidebar
   for any post that is in category Kayak, and can’t get that to work. Any hints?
 * Thanks,
    Geoff
 *  [alanft](https://wordpress.org/support/users/alanft/)
 * (@alanft)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/adding-sidebar-widget-only-for-certain-categories/#post-1042663)
 * it’s the difference between in_category and is_category
 * read about the difference on [http://codex.wordpress.org/Conditional_Tags](http://codex.wordpress.org/Conditional_Tags)
 * and you’ll find people doing the same thing in these posts [http://wordpress.org/tags/widget-logic](http://wordpress.org/tags/widget-logic)
 * i’ll probably add something about this in the FAQ or ‘other notes’ section soon
 *  Thread Starter [geoffcj](https://wordpress.org/support/users/geoffcj/)
 * (@geoffcj)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/adding-sidebar-widget-only-for-certain-categories/#post-1042666)
 * Alanft,
 * I had seen the codex page, but when I changed the logic code to in_category, 
   the widget doesn’t appear anywhere.
 * Thanks,
    Geoff
 *  Thread Starter [geoffcj](https://wordpress.org/support/users/geoffcj/)
 * (@geoffcj)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/adding-sidebar-widget-only-for-certain-categories/#post-1042667)
 * This code:
    is_category(kayak) || (is_single() && in_category(kayak))
 * Seems like it would do what I want, but it doesn’t. I get the widget displayed
   if I click on the category Kayak, but a single post within that category doesn’t
   have the widget.
 * ???
 * Geoff
 *  [alanft](https://wordpress.org/support/users/alanft/)
 * (@alanft)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/adding-sidebar-widget-only-for-certain-categories/#post-1042670)
 * you should check out the steps i mention in the FAQ. eg does it work in the default
   theme?

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Adding sidebar widget only for certain categories’ is closed to new replies.

## Tags

 * [categories](https://wordpress.org/support/topic-tag/categories/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [sidebar](https://wordpress.org/support/topic-tag/sidebar/)

 * 7 replies
 * 3 participants
 * Last reply from: [alanft](https://wordpress.org/support/users/alanft/)
 * Last activity: [17 years, 1 month ago](https://wordpress.org/support/topic/adding-sidebar-widget-only-for-certain-categories/#post-1042670)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
