Hey all.
I’m trying to list out a number of blog posts onto a page.
For the first link, I want to make the markup different to the rest of the items.
However, I can’t seem to specify the first item in a list to be different from the rest.
I tried this:
<?php
$items = $page->grandChildren();
$first = $items->first();
?>
<ul>
<?php foreach($items as $item): ?>
<?php if($item == $first) ?>
<h1>First item</h1>
<?php else ?>
<li>
<h1>Every other item</h1>
</li>
<?php endforeach ?>
</ul>
However, It didn’t work.
Any help would be greatly appreciated!