Get projects from children sites

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


$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>
		<?php endforeach ?>

I’dont get how it works. Please help me :slight_smile:

What do you get as result or what is not working as expected?

Please check:

  • is the page called projects?
  • are the children you are calling visible pages?

I had unvisible children pages. Thanks a lot. Best rigards :slight_smile: