0
votes

Say we have two categories, Cat-A and Cat-B,

And we are currently looking at the listing of all posts in Cat-A on the category archive page...

is it possible to check for other categories each post may also have associated with it?

For example:

<loop>
<list Cat-A>
If (Post also belongs to Cat-B) {
  class="Cat-B"
}else{
 class="global"
}
</loop>

I hope this makes sense....

1

1 Answers

0
votes

how about somthing like...

<?php 
if($posts......) loop: 
    if ( in_category( 'Cat-B' )) {
        echo 'class="Cat-B"';
    } else {
        echo 'class="global"';
    }
}
?>

if not you could try using the wp_get_post_categories(); to generate a list of current categories for that particular post,

Cheers Marty