Categories
(Offices)
$i = 1;
$med = 3;
$max = 6;
$cat = get_query_var('cat');
$maincat = get_category ($cat);
$slug = $maincat->slug;
if ($slug == "projects") {
$childcategories = get_categories('child_of=' . $cat . '&hide_empty=1');
}
else{
$catPar = get_category_by_slug("projects");
$catParId = $catPar->term_id;
$childcategories = get_categories('child_of=' . $catParId . '&hide_empty=1');
}
echo'';
echo'';
echo'';
?>
- ';
foreach ($childcategories as $childcategory) {
if (in_category($childcategory)) {
echo '
'; echo $childcategory->cat_name . '
'; echo ' ';
}
if ($i++ == 3){
$i = 1;
break;
}
}
echo'
- ';
foreach ($childcategories as $childcategory) {
if (in_category($childcategory && $i > $med)) {
echo '
'; echo $childcategory->cat_name . '
'; echo ' ';
}
if ($i++ == 6){
$i = 1;
break;
}
}
echo'
- ';
foreach ($childcategories as $childcategory) {
if (in_category($childcategory && $i > $max)) {
echo '
'; echo $childcategory->cat_name . '
'; echo ' ';
}
$i++;
}
echo'