<?php foreach ( ( get_the_category() ) as $cat ){ echo $cat->cat_name; // echo '<span>' . $cat->name . '</span>'; } ?>