Echo class depending on Parent category
you probably need to get the parent category of each of the post’s categories first. <?php $parent_cat = array(); $post_cats = get_the_category($post->ID); foreach( $post_cats as $post_cat ) { if( $post_cat->parent ) $parent_cat[] = get_category( $post_cat->parent )->slug; } ?> <article class=”post <?php if ( in_array( ‘dream-it’, $parent_cat ) ) { echo ‘ dreamit’; } if ( … Read more