I have the followind code:
<?php global $post;
$cat_ID=array();
$categories = get_the_category(); //get all categories for this post
foreach($categories as $category) {
array_push($cat_ID,$category->cat_ID);
}
$args = array(
'orderby' => 'date',
'order' => 'DESC',
'post_type' => 'post',
'numberposts' => 10,
'post__not_in' => array($post->ID),
'category__in' => $cat_ID
);
$cat_posts = get_posts($args);
if ($cat_posts) {
echo 'SOME HTML';
foreach ($cat_posts as $cat_post) { ?>
It currently lists all post which contain the same category as the current post you are on. What I would like it to do is to exclude the parent category.
The a example category list / example would look like this:
Work
- Animation
- Film
- Misc
When on a post eith the cat Animation all the other posts with the same cat show up (which is good ) but so does the main parent 'Work'. How do I exclude it?
THANK YOU!