Tell us what you are trying to do?
I would like to iterate through a repeating field, and treat the last item in the list differently than the rest of the items. Basically, I need to output a comma-separated list, but, before the final item, I need to output the word "and". So, if there is only 1 item in the list, it would output just the text of the item (e.g. "Item 1"). If there are two items in the list, it would output something like "Item 1 and Item 2". If there are 3 items in the list, it would output something like "Item 1, Item 2 and Item 3".
Is there a way for me to do this?
Is there any documentation that you are following?
I did look at the documentation for the wpv-for-each shortcode (https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-for-each) and the documentation for Repeating Fields (https://toolset.com/documentation/user-guides/repeating-fields/), but I didn't see any way to accomplish this there.
Is there a similar example that we can see?
No
What is the link to your site?
hidden link
Hello @curtissG, welcome to the Toolset support Forum!
I think this can be achieved using CSS + Pseudo Selectors.
FIrst, you need to wrap each item into a span, then use CSS to add the commas to each item. After that you should be able to remove the comma from the first item using the "first-child" and "last-child selectors"
Please take a look at this example: hidden link
All the best,
Diego