If you’re using it on single templates, the easiest & most efficient way would be to switch based on the value of get_post_type()
.
switch(get_post_type()) {
case 'news' :
// some statement for news type
break;
case 'sports' :
// some statement for sports type
break;
default:
// something to do when it's none of the above
break;
}
In my opinion a foreach
here would be an overkill(specially if there are a lot of post types like in the question)