Hello,
I am using if ($page->hasNext()) in my footer which works perfectly
Basically if page doesn’t have next I want to add padding to the bottom of this section
Is there a way to add class if page does not have next?
My code:
<?php if ($page->hasNext()): ?>
<a href="<?= $page->next()->url() ?>" class="news__wrapper">...etc
<?php endif ?>
<?php echo ($page->hasNext() === false ) ? 'class="someclass"' : null; ?>
Thanks for your reply - I can’t seem to get this working
I was thinking the css would look like this
.news__wrapper .someclass {
padding-bottom: 8rem;
}
Not quite sure what you want to output here, but I think we have to change the structure instead:
<?php if ($page->hasNext()): ?>
<a href="<?= $page->next()->url() ?>" class="news__wrapper"></a>
<?php else: ?>
<a href="" class="news__wrapper someclass"></a>
<?php endif ?>
2 Likes