Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter frmars

    (@frmars)

    May I add that I created the category I want to exclude SPECIFICALLY, so that I could exclude (but how ?) straight away all its children from the homepage ?

    Thread Starter frmars

    (@frmars)

    Can anyone help me ?

    This is UNTESTED, but it should be close:

    <?php $blog_cat = 22;  // The blog parent category ID
    $cat_excludes = array(6,25,50,51);
    $children = get_categories("child_of=$blog_cat");
    foreach ($children as $child) {
       $cat_excludes[] = $child->cat_ID;
    }
    $args = array(
       'paged' => $paged,
       'category__not_in' => $cat_excludes
    );
    query_posts($args); ?>
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Include and exclude multiple categories children’ is closed to new replies.