# Multiple sliders on one page

**URL:** <https://forum.getkirby.com/t/multiple-sliders-on-one-page/11636>\
**Category:** Questions\
**Tags:** v2\
**Created:** [November 11, 2018, 10:35pm UTC](https://forum.getkirby.com/t/multiple-sliders-on-one-page/11636 "2018-11-11T22:35:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mafleig](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mafleig/32/15806_2.png) [@mafleig](https://forum.getkirby.com/u/mafleig)\
**Post date:** [November 11, 2018, 10:35pm UTC](https://forum.getkirby.com/t/multiple-sliders-on-one-page/11636/1 "2018-11-11T22:35:14Z")

</div>

Hi, i´m trying to put multiple sliders on a portfolio page with the following code and folder structure:

```
    <main class="main" role="main">
  <div class="wrap wide">
    <ul class="showcase grid gutter-1">
     <li class="showcase-item column">
      <?php $projects = page('home')->children()->visible();?>
      <?php foreach ($projects as $project): ?>
        <div class="slider">
            <?php foreach (page('home')->Children()->images() as $image): ?>
                <img src="<?= $image->url() ?>">
            <?php endforeach ?>
        </div>
      <?php endforeach ?>
      </li>
    </ul>
  </div>
</main>

```

but i always end up with all images of all folders in every slider.

 ![10](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/2/2bf6dd5c5d293bb81e16dd0fe287148f4a49b7bd.jpeg)

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [November 11, 2018, 10:46pm UTC](https://forum.getkirby.com/t/multiple-sliders-on-one-page/11636/2 "2018-11-11T22:46:25Z")

</div>

It’s because of that second inner for each loop…

```
    <div class="slider">
        <?php foreach (page('home')->Children()->images() as $image): ?>
            <img src="<?= $image->url() ?>">
        <?php endforeach ?>
    </div>

```

That is telling it to fetch all images, repeatedly, for as many times as there are `$projects`

You need to change it to this, i think…

```
    <div class="slider">
        <?php foreach ($project->images() as $image): ?>
            <img src="<?= $image->url() ?>">
        <?php endforeach ?>
    </div>
```

---

<div class="post-metadata">

**Author:** ![mafleig](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mafleig/32/15806_2.png) [@mafleig](https://forum.getkirby.com/u/mafleig)\
**Post date:** [November 11, 2018, 10:52pm UTC](https://forum.getkirby.com/t/multiple-sliders-on-one-page/11636/3 "2018-11-11T22:52:38Z")

</div>

percfect. works as expected, thanks!

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [November 11, 2018, 11:08pm UTC](https://forum.getkirby.com/t/multiple-sliders-on-one-page/11636/4 "2018-11-11T23:08:00Z")

</div>

No problem… you might want to consider using the thumb class though, depending on what you want to achieve. This opens up the ability to crop or resize the images, so you end up with nice uniformly sized images in your slider. This means you don’t have to be careful that all your source images are the right size for the slider. You can see how this works [here](https://getkirby.com/docs/templates/thumbnails).

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:25pm UTC](https://forum.getkirby.com/t/multiple-sliders-on-one-page/11636/5 "2025-02-06T17:25:51Z")

</div>

Archived on February 6, 2025, 5:25pm UTC


