Convert tag field values first character to uppercase

Hey there.
I have a tags panel field and want to output its values with the first character in uppercase (despite the fact that I entered it in such manner in the panel),

so:

‘editorial’ becomes ‘Editorial’ and so on …

Thanks in advance!

ucfirst() is your friend :slight_smile:

1 Like

After looping over the tags, you can use str::ucfirst($tag) to uppercase only the first letter.

This is an UTF-8 safe version of ucfirst().

1 Like

Thanks,
however this only works with the first word, but some tags consist of two words (sorry I didn’t mention this before)

Then there’s ucwords(), you might want to check if there’s a UTF-8 safe version in the toolkit. Just did, and there is:

str::ucwords()

Many thanks, once again