Hi,
I’m trying to add a class the the last image of a slider. Am I doing something wrong here? My code is not working
<?php foreach($page->slider()->toFiles() as $mediaFile): ?>
<?php
// Classes
$class = 'space-bottom-3x';
if ($mediaFile->isLast()) {
$class = $class . ' space-bottom-none';
}
?>
<img class="<?php echo $class; ?>" ...>
<?php endforeach ?>
Best,
Johan