• How can I make sidebar 1 show up on just in posts in category 1, sidebar 2 in category 2 posts etc?
    I thought I’d solved this using the brilliant Widget Logic plugin, but now it turns out that the sidebar disappears when clicking Read more… to see a complete post. (The overview page only shows the first lines of each post – cut off with the More function.)
    Can someone please tell me – either:
    – Another way to make sidebar content appear by category?
    – Another way of cutting of posts in a category archive – so the users only see the first part of each post – without using the More function? (It can not make the cut after eg 100 words or the like, the ingress length will vary)
    – Which WP file is used to show the complete post when clicking read more…? (Maybe the sidebar code is missing there)
    This is about all that stops WP from being a complete cms for a big site, so i’m grateful for any tips.
    Thanks,
    Kjetil

    dolcevita.no – hopefully soon transfered to WP on dolcevita.no/wp – all categories and posts are under the far-left dropdown menu

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Kjetil

    (@kjetilgf)

    Anyone…?

    Cathy Mitchell

    (@multitalentedmommy)

    For different sidebars in a category template, you’ll need to edit the category.php template in your theme. And include if…else statements before the loop.

    There is probably another way to do it if you write php yourself and make a function to define the cat variable, so you can call a specific sidebar based on the category id. but that is beyond me.
    GOod luck.

    Cathy Mitchell

    (@multitalentedmommy)

    as for your other questions, the codex can answer much more thoroughly: here and here. If you have more specific questions about the_excerpt tag or the single.php file, then ask them here.

    to health & happiness,
    Cathy

    Thread Starter Kjetil

    (@kjetilgf)

    Thanks, – I might give it a try, even if I’m not much into php handwriting.
    BUT – if I understand this correctly – it means that

    • I would have to make one IF statement for each category (which should have its own sidebar)?
    • And then also make one particular sidebar file for each of them? (What I’ve done, should give the same result: I’ve made one category file for each out of 25 categories.)

    But your point of using an excerpt is really worth a try.
    Thanks
    – Just need to find out which file is used for the Read more… thing first.
    Kjetil

    Cathy Mitchell

    (@multitalentedmommy)

    See the template hierarchy codex article which explains how wp chooses a template to display the posts.
    If you call the <?php get_sidebar();?> in every category template, it will retrieve the same sidebar every time. Instead, code your cat’s sidebar into its custom category template. Or you can use<?php include(TEMPLATEPATH . '/differentsidebar.php'); ?>. Whichever will allow easier edits in the future when sidebars change or more categories are added.

    All the themes that I’ve downloaded use single.php for full posts. And they may or may not have a <?php get_sidebar();?> call attached.

    Excerpt manipulation – use a plugin like this one. check before activating a plugin if you have a version compatible with your wp version.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Category-specific sidebar – how?’ is closed to new replies.