Hey,
I have a small problem with my Site. I would like to link multiple Images to their each individual subpage.
My page structure looks like this.
- Home
- About
- Projects
- Image 1 → Link to project 1 subpage
- Image 2 → Link to project 2 subpage
- Image 3 → Link to project 3 subpage
a website with a project page. On that are multiple images. Each Image represent a subpage, i want to link to.
My code looks like this.
<div class="portfolio-image">
<?php foreach($page->children() as $subpage): ?>
<figure>
<?php foreach($page->images()->sortBy('sort') as $image): ?>
<a href="<?= $subpage->url() ?>">
<img src="<?= $image->url() ?>">
</a>
<?php endforeach ?>
</figure>
<?php endforeach ?>
</div>
The problem is, that I get all 3 images with the link to the project 1 subpage. Then again all 3 images with the link to suppage 2 and so on. I can feel it, I´m nearly there, but I cant get it to work. Thanks for your help.