switching sidebar (2 posts)

  1. cshsky
    Posted 10 years ago #

    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?


  2. petit
    Posted 10 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic