How do you fetch content from subpages in different page that your code is in?
For example, I’m trying to fetch content from subpages in the “testimonials” page to show up on my home page.
Here’s the code, which is obviously giving me errors:
<?php $tesitmonial = $site->page('testimonials')->children()->find('aaron-valenty'); ?>
<div class="testimonial__container sml med--col-6 med--offset-1 xlrg--col-6 xlrg--offset-3">
<img src="<?php echo $testimonial->image()->toFile['url'] ?>" alt="<?php echo $testimonial->image()->toFile['alt'] ?>" class="testimonial__image">
<div class="testimonial__client">
<h5 class="testinomial__client-name"><?php echo $testimonial->title ?></h5>
<h5 class="testimonial__client-site">
<?php if($testimonial->site-link() != ''): ?>
<a href="<?php echo $testimonial->site-link ?>" class="testimonial__client-link" target="_blank"><?php echo $testimonial->site ?></a>
<?php else: ?>
<?php echo $testimonial->site ?>
<?php endif ?>
</h5>
</div>
</div>
<?php endif; ?>