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.

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}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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