Output Modifier for first word only

Hi there!

I have a ‘meet the team’ section, where there is a page for each team member.
The pagetitle is their Full Name.
I want to be able to use just their first name within the text - so was thinking i could use an output modifier to show just the first word of the pagetitle, but I can’t work it out.

I assume I would need a custom modifier snippet - Has anyone done this before?

I know I could add an extra TV for the first name, but that feels like cheating!!

Thanks in advance!

Create a snippet called firstWord with code like this:

$words = explode(" ", $input);
return $words[0];

Then use the snippet as an output modifier with [[*pagetitle:firstWord]].

That’s brilliant - thank you!
So simple and so effective!


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.