WordPress.org

Support

Support » Themes and Templates » switching sidebar

switching sidebar

  • hello folks,

    i know, with if(is_category) i can have a different sidebar for every category, page (..), but i want to realize that with the php-switch()… is that possible? as a php-learning-noob i tried it, but didnt know how to handle that ..

    any tips here?

    thanks.

Viewing 1 replies (of 1 total)
  • I’m no hero at PHP, but maybe you could use something like this, to avoid a long winding list of if statements:
    <? php get_the_category()) as $cat ?>
    <?php include('sidebar' . $cat->cat_ID . '.php'); ?>

    If not, I’m sure you could use the category ID some way.
    See the Category id

Viewing 1 replies (of 1 total)
  • The topic ‘switching sidebar’ is closed to new replies.