How to List Categories and Vary -y and -ies Suffixes? (1 post)

  1. ccano
    Posted 9 years ago #

    Hi everyone. Here's what I'm trying to do, I'd be very grateful if you can help me:

    I want to include a sentence under each of my posts that says "If you enjoyed this post, read more like it in the [category name(s)] category OR categories.

    Here are the things that would vary: if there's one category, the sentence should read "in the BLANK categorY. If there are two categories, it should say "in the BLANK & BLANK categorIES. If there are more than two categories, it should say "in the BLANK , BLANK & BLANK categorIES.

    So the -y and -ies categor- suffixes would change depending on the number of categories. And a comma would be added between categories (except the last one, which would take an &) if there were more than two categories.

    I'd imagine there's a way to do this with PHP, but how? Thanks a ton in advance.

Topic Closed

This topic has been closed to new replies.

About this Topic