I'm trying to limit the amount of categories that show up above my post title, below is an example of what is happening I'm fine with just grabbing the first 2 categories that show up and limit them to that.
I have found functions that accomplish this with tags but nothing with categories. For example in this custom function, it limits the tags to five in functions.php
add_filter('term_links-post_tag','limit_to_five_tags');
function limit_to_five_tags($terms) {
return array_slice($terms,0,5,true);
}
Then in single.php
use <?php the_tags() ?>
.
Any idea how to accomplish this with categories?