Hi,
I’m trying to create a simple foreach which displays the latest testimonial from the news page but for some reason the below isn’t working - Any help / advice as to what I’m doing wrong here would be much appreciated.
If I remove ‘->filterBy(‘testimonial’, ‘,’)’ then the content from the news page is displayed so I have a feeling within the $testimonials variable I need to define the pages and then somehow filter these the tag as a second step, this that correct?
<?php if ($newspage = page('news')): ?>
<?php $testimonials = $newspage->children()->listed()->filterBy('tag', 'testimonial')->limit(1); ?>
<h1>Testimonials</h1>
<div class="container testimonial bottom-margin">
<div class="row">
<div class="">
<?php foreach ($testimonials as $testimonial): ?>
<h1>Testimonial Title</h1>
<?php endforeach ?>
</div>
</div>
</div><!-- .container -->
<?php endif ?>
Thank you,
Lewis