• geoffcj

    (@geoffcj)


    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

    (@macondo)

    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/

    Good luck!

    alanft

    (@alanft)

    Thread Starter geoffcj

    (@geoffcj)

    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 , 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

    (@alanft)

    it’s the difference between in_category and is_category

    read about the difference on http://codex.wordpress.org/Conditional_Tags

    and you’ll find people doing the same thing in these posts http://wordpress.org/tags/widget-logic

    i’ll probably add something about this in the FAQ or ‘other notes’ section soon

    Thread Starter geoffcj

    (@geoffcj)

    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

    (@geoffcj)

    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

    (@alanft)

    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.