Hello,
i have a problem with get projects on the parent page.
In a interior-projects site (template: projects.php) i would like to get all of projects with first images ant titles from children sites (template: project.php)
I try to to get it in this way
<?php
$projects = page('projects')->children()->visible();
if(isset($limit)) $projects = $projects->limit($limit);
?>
<ul class="row projects">
<?php foreach($projects as $project): ?>
<li class="project mt-3 mt-lg-4 col-12 col-md-6 col-lg-4">
<a href="<?= $project->url() ?>" class="project-href">
<?php if($image = $project->images()->sortBy('sort', 'asc')->first()): $thumb = $image->crop(600, 600); ?>
<img src="<?= $thumb->url() ?>" class="img-fluid zdjproject" alt="<?= $project->title()->html() ?>">
<?php endif ?>
<div class="project-title">
<h3 class="project-name"><?= $project->title()->html() ?></h3>
</div>
</a>
</li>
<?php endforeach ?>
</ul>
I’dont get how it works. Please help me