Radical Design Course by Jack McDade

From the creator of Statamic

Learn how to make your websites standout and be remembered.

This course is the most refreshing take on teaching design that I've come across.

— Mikaël Sévigny, Developer

wrap Modifier

Wraps a string with a given HTML tag. Has the nice benefit of returning null if there is no data, eliminating the need for simple {{ if }} wrappers.

title: As the World Turns
{{ title | wrap('h1') }}
{!! Statamic::modify($title)->wrap('h1') !!}
<h1>As the World Turns</h1>

You may also use Emmet-style CSS classes to be added to the tag.

{{ title | wrap('h1.fast.furious') }}
{!! Statamic::modify($title)->wrap('h1.fast.furious') !!}
<h1 class="fast furious">As the World Turns</h1>

The wrap modifier also accepts passing in arrays.

team_members:
- Jack
- Jason
- Jesse
- Josh
- Duncan
- The Hoff
{{ team_members | wrap('li') | join(' ') }}
{!! Statamic::modify($team_members)->wrap('li')->join(' ') !!}
<li>Jack</li>
<li>Jason</li>
<li>Jesse</li>
<li>Josh</li>
<li>Duncan</li>
<li>The Hoff</li>
Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →