WordPress.org

Ready to get started?Download WordPress

Forums

switching sidebar (2 posts)

  1. cshsky
    Member
    Posted 8 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?

    thanks.

  2. petit
    Member
    Posted 8 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

Tags