WordPress.org

Ready to get started?Download WordPress

Forums

Widget/sidebar for each category? (23 posts)

  1. kjetilgf
    Member
    Posted 6 years ago #

    Hi
    Is there such a plugin available:

    I'd like the posts in each category to show it's own sidebar - or even better: To have one widget to show up on the posts of each category.

    I'm converting a site about Italy, and for each region I'd like the top of the sidebar to show info, links etc which are relevant for just that region.
    Eg, on the Toscana page I would like it to show links to local places, photo galleries etc which are not relevant on the Sicilia posts - have a look at the right side here.
    So - I don't need a widget that displays categories, but a plugin that assigns one unique widget in the sidebar of each category's posts.

    I've tried to achieve it using the html templates and the Widget changer. The widget changer comes closest, but since it can only be used on posts (and pages), and not on categories, it has to be inserted and even edited in the posts one by one. (I'd even have to format/prepare the contents in an html editor, Dreamweaver or the like.)

    Such a plugin would save me lots of work, so I'm grateful for any suggestions.

    Thanks,
    Kjetil

  2. kjetilgf
    Member
    Posted 6 years ago #

    No such thing?
    Crucial for using WP as a CMS, I believe - so still hoping
    :-) Kj

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    No such thing yet. It's being planned to allow for custom sidebars like that though. Probably not until WP 2.6.

  4. kjetilgf
    Member
    Posted 6 years ago #

    Hm - Ok
    Thanks
    Thought about another possibility.
    Since each region has its own category (thats how I can post to multiple pages) and I'd have to make a template for each category - then I could make a different sidebar template for each category as well. or mayby make the sidebar a part of the page template.
    Someting like that...?

    PS This "pages" thing is confusing. Why not call a static Page a page, while the pages generated by each post in a blog is a sheet? Just a thought.

  5. alanft
    Member
    Posted 6 years ago #

    try out my new widget Widget Logic. At worst you could have a text widget for each category set to appear only when is_category(x).

  6. kjetilgf
    Member
    Posted 6 years ago #

    Thanks!
    Might be just what I'm looking for. The sidebar should have a category-unique widget + the standard widgets (or maybe I'll even need some single-page widgets as well, but Widget changer solves that part)

    It says its only compatible up to 2.3.2?
    I'll tell you over the weekend how things have gone.
    :-)

  7. alanft
    Member
    Posted 6 years ago #

    (i've only bothered with 2.3.1 and then done spot fixes of the important bugs in 2.3.2 and 2.3.3)

    cheers. i should have said that Widget Logic is a PLUGIN not a widget. it's a plugin that allows you to specify on which pages any widgets appear.

    You can for instance set a widget (eg a Text widget) to appear if:

    is_category(4) || in_category(4) || is_page('umbria')

  8. kjetilgf
    Member
    Posted 6 years ago #

    Thanks, got the point :-)
    The very best so far - it ALMOST fill my needs - but is there any way to activate more text widgets? Or some other way around?

    Point is:
    I'd like different texts to appear in the top of the sidebar on each category's posts. Your plugin does this perfectly: If I insert eg "is_category('9')" in the conditional field that the plugin gives each widget, that widget only show up beside the category 9 posts.
    So far, so good - but:
    My Italy site will have 20+ categories (as there are 21 regions in Italy), while the Presentation > Widgets panel gives maximum 9 of each widget type.
    Any way to get around?

    Thanks again
    Kjetil
    Dolcevita.no/wp

    PS Your ReadMe text is very helpful, but inserting a conditional text as said there, returns an error. "is\_category(5)" makes it wrong - "is_category('9')" makes it right. Just like to tell you :-)

  9. alanft
    Member
    Posted 6 years ago #

    good point. i will amend my readme. (The 'development' version is already quite modified from what you see.)

    i can think of 2 main options

    1 - write category-1.php category-2.php etc files one for each category with your text written into each of those

    2 - use the category description and find a widget that lists category descriptions (for each category a post is in). alternatively write your own code to print that description. Something like:

    if (is_category()) { echo category_description($cat);}

    hope this helps

  10. kjetilgf
    Member
    Posted 6 years ago #

    Thanks for sharing your thoughts.
    I've already made different category templates, so that's fine. (Need them to make post in different categories to show up on different sheets (not to mix up with Pages).)
    I don't believe too strongly, though, that a category description will do, since I'd have to include some code (basically html) in it.
    I might just write each category's own code into a sidebar.php for each and every category (like sidebar-1.php). Using your plugin wuold be much more elegant, but...

    It should be quite essential for using WP as a CMS, but as Otto said, maybe it'll be part of WP 2.6 - and that should be about in the time I need to fill everything into this (for now) 250 page site :-)

    Thanks
    Grateful for your help

  11. alanft
    Member
    Posted 6 years ago #

    thing is you've got text for lots of categories. so how/where to store them. without some extension to WP via a plugin, the description seems the only place to hand. and you can use HTML in category descriptions. (well i do on one blog i admin, and i don't recall hacking it, or using a plugin to do so!)

  12. artcase
    Member
    Posted 6 years ago #

    using standard WP you get up to 9 text boxes. change the number in the pull-down box.

    I'm wondering if you could change the number to a higher one?

    Also,

    With the text widget in widget-logic, can you input php functions? *edited: it doesn't work. Text will show, images will show, links will show, but a function like:

    <ul>
    <?php wp_list_categories('orderby=id&show_count=1
    &use_desc_for_title=0&child_of=8'); ?>
    </ul>

    will not show.
    *end edit

  13. kjetilgf
    Member
    Posted 6 years ago #

    For me the question ended up in how to get more than 9 text widgets available. I haven't tried it myself yet, but after asking here, the answer seems to be in this tread
    Together with the widget-logic plugin, this should solve things for me.
    Kjetil

    PS This tread is also worth reading

  14. artcase
    Member
    Posted 6 years ago #

    Way cool! I knew it had to be something that easy, but will it be replaced when you upgrade? (back it up and make notes...I guess)

    OK, so I've read in the documentation that text widgets support html and javascript markup.

    So...can anyone show me a link to an example for the wp_list_categories function that is in either of these two formats. I'll figure out what I need from there.

  15. artcase
    Member
    Posted 6 years ago #

    I found it! the perfect combo...
    widget-logic and
    this one: http://wordpress.org/support/topic/161414?replies=1

  16. kjetilgf
    Member
    Posted 6 years ago #

    To put it more precisely, to get more text widgets - have a look at my latest reply here.
    Great!

  17. kjetilgf
    Member
    Posted 6 years ago #

    The Widget logic plugin is perfect - but it doesn't display for instance a category specific widget after clicking Read more... on a post. (Only "normal" widgets display)
    A plugin problem - or something else?
    Alan?
    Thanks,
    Kjetil

  18. alanft
    Member
    Posted 6 years ago #

    you need extra logic as 'is_category(x)' won't work on a single post page.

    you could do 'is_category('x') || (is_single() && in_category('x'))

  19. kjetilgf
    Member
    Posted 6 years ago #

    Should have said it right away, but
    That does the trick!
    A truly useful plugin for using WP as a CMS!

  20. hushwuff
    Member
    Posted 6 years ago #

    Hi alanft, Cool feature.
    When are you posting your plugin for 2.5?
    Thanks

  21. alanft
    Member
    Posted 6 years ago #

  22. stube
    Member
    Posted 6 years ago #

  23. kjetilgf
    Member
    Posted 6 years ago #

    I truly do not understand what you're asking for. What is your need?
    Read this thread and the descriptions given on the plugins' pages, - maybe that will give you an answer.

Topic Closed

This topic has been closed to new replies.

About this Topic