使用foreach循环:
<?php foreach ( $terms as $term ) { if($curPostCatID === $term) { ?> // conditional output here <?php } } ?>