Support » Fixing WordPress » Conditonal getting children of parent with in_category

  • 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!

    						if(in_category(array('cat1','cat2','cat3')) {
          include(TEMPLATEPATH . '/news-sidebar.php');
           } elseif( in_category(array('training','ask')) ) {
    	include(TEMPLATEPATH . '/training-sidebar.php');
     } ?>
  • The topic ‘Conditonal getting children of parent with in_category’ is closed to new replies.