On my WordPress theme, it displays all of the categories a post is in on the homepage for the post block, I only want to display one category even if a post is under multiple categories.
i.e. Category One, Category Two, Category Three
I want it to be Category One…
This is the code that is in place at the moment:
<h2><?php the_category(', ') ?></h2>
What do you mean by first category? The following code will show only the one category, but it will sort the categories by name.