Support » Plugins » How to display only one Category name that a post is filed in?

  • Hi,

    Say I have a post filed in two categories, such as “Foo” and “Bar”.

    What php code could I use to display only ONE of those categories?

    I know that (for example):
    <p class=”postmetacomment”><?php the_category(‘, ‘) ?></p>

    …will write ALL categories that the post was filed in, the example above would write “Foo, Bar”.

    But how can I write just ONE of those category names? Say I just wanted to write either “Foo” or “Bar”?

    Thanks in advance.

  • The topic ‘How to display only one Category name that a post is filed in?’ is closed to new replies.