2

I have this code:

{categories}{category_name}, {/categories}

Outputting in a Entries Tag Pair.

I would like to remove the comma from the last outputted category only. I am thinking an IF statement but am not really sure what would be appropriate for this.

Any help would be much appreciated.

1 Answer 1

4

What you want is the backspace parameter.

"Backspacing removes characters (including spaces and line breaks) from the last iteration of the loop."

{categories backspace="2"}{category_name}, {/categories}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.