I’m not sure if I get you right, but if so, this will solve your problem:
<?php
$classes = array();
$subjects = get_the_terms( get_the_ID(), 'subject' );
$categories = get_the_terms( get_the_ID(), 'category');
if ( count($terms) > 1 ) {
$classes[] = "reset";
} else {
foreach ($subjects as $term ) {
$classes[] = $term->slug;
}
}
$title_terms = ( count($subjects) ) ? $subjects : $categories;
?>
<div class="columns small-12 ">
<div class="single-title <?php echo implode($classes, ' '); ?>">
<h2><?php
if ( count($title_terms) > 0 ) {
echo $title_terms[0]->name;
/* Or change it to this, if you want to display all of terms
foreach ($title_terms as $term) {
echo $term->name;
}
*/
}
?></h2>
<hr/>
</div>
</div>