WordPress.org

Ready to get started?Download WordPress

Forums

Conditonal getting children of parent with in_category (1 post)

  1. misterpatrick67
    Member
    Posted 3 years ago #

    Hello all,

    I need some WordPress Kung Fu. I have a conditional loading various sidebars depending on the category. So I don't have to update this when adding new categories, I'd like to just pull the children of a category and have that fill the array instead of manually putting all the children in.

    Can someone help me out with some PHP? Thanks!

    <?php
    						if(in_category(array('cat1','cat2','cat3')) {
          include(TEMPLATEPATH . '/news-sidebar.php');
           } elseif( in_category(array('training','ask')) ) {
    	include(TEMPLATEPATH . '/training-sidebar.php');
     } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic