This snippet is meant to create a switch out of your archive.php file.
This code checks to see if the current category is ID#4 or is a child category of ID#4. It then sends you to the specific archive page, in this case is archive-category4.php. If the post has nothing to do with category 4 then you are sent to the default archive page which is just the archive.php file renamed archive-blog.php
This code checks to see if the current category is ID#4 or is a child category of ID#4. It then sends you to the specific archive page, in this case is archive-category4.php. If the post has nothing to do with category 4 then you are sent to the default archive page which is just the archive.php file renamed archive-blog.php
<?php
//This block is for the archive.php file
$categories4 = get_categories('child_of=4');
foreach ($categories4 as $cat) {
$the_category = $cat->cat_ID;
$check_category = is_category($the_category);
if ($check_category == 1){
include ('archive-category4.php');
exit;
}
}
if (is_category (4)) {
include ('archive-category4.php');
exit;
}
include ('archive-blog.php');
?>
