Is there a way to display the first word of a field? #4358
-
I've been reviewing the Statamic modifiers and wanted to make sure I wasn't overlooking a way to display the first word of a field. In my case, I have a field that has a First Name and Last Name in one field. I was hoping to pull out the first name by grabbing just the first word in a field. Everything before the first   Any ideas on a way to do this? Alternatively, in my case, the slug is firstname-lastname too, so I even thought of being able to grab the first word within the slug (all letters before the first dash). Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I would have suggested |
Beta Was this translation helpful? Give feedback.
-
Another potential solution (If you know the last name is only one word) is the Input:
Antlers:
Output:
|
Beta Was this translation helpful? Give feedback.
I would have suggested
{{ var | explode:" " | first }}
but it doesn't look like a space works in explode there.