Looking for a wordpress plugin

by 13 replies
15
I'm hoping you talented folks can help with my search.

I am looking for a plugin that will allow me to show a different sidebar depending on the category of the post.

I've tried searching but I can't seem to find anything suitable.

Thanks for your help.
#website design #customise #plugin #sidebar #wordpress
  • Hey,

    I'm not sure about a plugin, but you can do this pretty easy with PHP,
    You would need to find the ID of the current page, and if it is true show this sidebar, otherwise show this sidebar.

    could you explain what your trying to swap, that wayI can post some code you could try out.
    • [1] reply
  • Thenka for the reply Carlo - this is the sort of thing I have in mind (fictional humerous made up scenario!)

    I have a site "LetMeScamYou.com"

    On this site I have a number of related categories:
    • **** berry made me lose 400 pounds in one minute
    • I'm a woman and I still enlarged my manhood to twenty seven and a half inches overnight
    • Google pays me over $1 billion every few seconds
    • The IRS always contacts you with a foreign e-mail address to let you know you are in trouble

    For each category I have a customised side bar - with things like an emial opt in, specific posts of interest, specific advert for scummy product and product specific links. I also have a generic sidebar

    So when either the category page is selected, a page from a particular category or post from a particular category is selected then the custom side bar is displayed.

    So I need some way to have several sidebars made, then a way to choose which sidebar is displayed.

    I think I can work out the logic for sidebar selection - but it falls ouside my (non-existent) programming skills! I totally lack any idea where to start for the multiple sidebars though

    For sidebar slection it would be something like;

    If category is **** then show sidebar ****
    If category is manhood then show sidebar manhood
    If category is google then show sidebar google
    If category is IRS then show sidebar IRS
    Else show sidebar generic

    I hope that explains it in an understandable way!

    Thanks
  • Now, doing it that way is a bit difficult. I think it's still possible with Widget logic. is_category() conditional tag is all that's required. You can customize it for different categories. However, it is possible only if you have different widgets and place them in single sidebar.

    To switch sidebar according to theme, you will have to modify template file. If your theme has a category template, you just need to use conditional tags there.
  • Thanks for the reply Ishan - but I don't think that will work for what I want.

    I don't want a single sidebar with different widgets depending on the category.

    I need different sidebars - probably with the same widgets.

    Each sidebar will look the same - just have different content.

    I'm afraid I didn't understand you second paragraph at all. I am having the same theme all the time, and I don't understand category templates at all. - sorry this is probably a reflection on my lack of understanding here.

    Thanks for your help
  • My fault there.

    So, you want multiple sidebars and way to display them in category pages(that is, pages listing posts from single category) or on posts that belong to a category. That can be done. I remember a plugin that could do that but have forgotten about it. I will try to look for it in plugin directory and post if I find something.
  • Just found it. It's called Sidebar Generator. wordpress(dot)org/extend/plugins/sidebar-generator/

    However, it supports only page/post wise selection!

    P.S. Sorry for the link! I have yet to complete 15 posts!
  • That is it exactly Ishan - thanks.

    I was sure it could be done - and I have tried searching the plugins database - but nothing seems to be what I want!
    • [1] reply
    • Hey,

      I hope the plugin works perfect for you, however if it fails to perform as you wish, let me know and I can show you exactly what you need to do using php.

      Cheers

      Carlo
  • Glad I could help.
  • Sorry Ishan, our posts crossed - what you describe is exactly the behaviour I want - but that plugin doesn't do that.

    I need something to allow me to create multiple sidebars - then something else to allow me to select which sidebar goes with which category. Preferably something that allows me to do the action once - If I have to modify every singel post I will go insane.

    Thanks everyone for thier help
    • [1] reply

    • As already suggested, the widget logic plugin will work for what you require. You'd have to setup each sidebar within the mainframe of the sidebars you already have, but just duplicating and applying the conditional tags for which widgets you want to show in which sidebar.

      You'd go about it like this:
      1. install and activate the plugin.
      2. Go to your sidebar and configure the widgets you want to show for category 1. In the widget logic section at the bottom of each widget, you'd paste the code: is_category('1')
      or whatever your category number is.
      3. Repeat for the next category.

      If there are some widgets you want to appear across all categories, you do not have to put anything at all. This will make the widget appear everywhere. It's based of the wp conditional tags so you'd have to check out those to see if you want to add any other restrictions or additions.

      Do note that if you place a widget in one position that is supposed to show up on all the sidebars, that you make note of the position you are placing it in relative to the other widgets. It will retain it's position no matter what conditionals are used so if you want a certain widget to always appear at the bottom, make sure that it is always moved to the bottom no matter how many widgets you add.

      Sounds like a deal of effort, but it's really an easy copy and paste effort.
      • [1] reply

Next Topics on Trending Feed