If I use this code(code not complete, this is the problem section), the posts appear properly. NOTE the "new WP_Query('cat=2,3,5,6,7,8,9');":
$catslugs = array('academic',/*'adventure',*/ 'arts', 'religious', 'special-interest', 'special-needs', 'sports','teen');//Must upate as new Main categories are added
$out = array();
foreach($catslugs as $slug) {
array_push($out, get_category_by_slug($slug)->term_id);
$CatIDs= implode(',', $out);
}
//featured category ID = 153
//academic category ID = 2
//adventure category ID = 4
//arts category ID = 3
//religious category ID = 5
//special-interest category ID = 6
//special-needs category ID = 7
//sports category ID = 8
//teen category ID = 9
$CatIDsCode="'cat=".$CatIDs."'";
$camp_posts_bynumber = new WP_Query('cat=2,3,5,6,7,8,9');
if( $camp_posts_bynumber->have_posts() ):
If I change it to this it doesn't. Instead it shows ALL categories including "Uncategorized". What am I doing wrong? Is it something with "have_posts()"
$catslugs = array('academic',/*'adventure',*/ 'arts', 'religious', 'special-interest', 'special-needs', 'sports','teen');//Must upate as new Main categories are added
$out = array();
foreach($catslugs as $slug) {
array_push($out, get_category_by_slug($slug)->term_id);
$CatIDs= implode(',', $out);
}
//featured category ID = 153
//academic category ID = 2
//adventure category ID = 4
//arts category ID = 3
//religious category ID = 5
//special-interest category ID = 6
//special-needs category ID = 7
//sports category ID = 8
//teen category ID = 9
$CatIDsCode="'cat=".$CatIDs."'";
$camp_posts_bynumber = new WP_Query($CatIDsCode);
if( $camp_posts_bynumber->have_posts() ):
OR
$catslugs = array('academic',/*'adventure',*/ 'arts', 'religious', 'special-interest', 'special-needs', 'sports','teen');//Must upate as new Main categories are added
$out = array();
foreach($catslugs as $slug) {
array_push($out, get_category_by_slug($slug)->term_id);
$CatIDs= implode(',', $out);
}
//featured category ID = 153
//academic category ID = 2
//adventure category ID = 4
//arts category ID = 3
//religious category ID = 5
//special-interest category ID = 6
//special-needs category ID = 7
//sports category ID = 8
//teen category ID = 9
$CatIDsCode="'cat=".$CatIDs."'";
$camp_posts_bynumber = new WP_Query($CatIDs);
if( $camp_posts_bynumber->have_posts() ):