Hey there!
i have a page with multiple foreach loops. Each loop contains a different type of content (loop through all projects, through all workshops, through all events…). Now I want to shuffle these loops. If I add it to every single foreach loop the items get only shuffled within their div. but I want to shuffle everything together, so projects, workshops and events are mixed together.
I hope I could deliver my problem properly.
Thanks so much in advance for any help!
Here you can see the code:
<?php
$allProjects = $site->find("projekte")->children();
$allWorkshops = $site->find("workshops")->children();
$events = $site->find("events")->children();
?>
<ul class="shelf-wrapper">
<!-- PROJEKTE -->
<?php foreach ($allProjects as $projekt): ?>
<a href="<?= $projekt->url() ?> " class="book-spine-wrapper">
<li class="book-spine draggable" title="<?= $projekt->title() ?>">
<div class="book-3d-top"></div>
<img class="spine-img" src="<?= $projekt->image()->url() ?>" alt="<?= $projekt->title() ?>">
<div class="spine-p-wrapper">
<p><?= $projekt->title() ?></p>
</div>
</li>
</a>
<?php endforeach ?>
<!-- WORKSHOPS -->
<?php foreach ($allWorkshops as $workshop): ?>
<a href="<?= $workshop->url() ?> " class="book-spine-wrapper">
<li class="book-spine draggable" title="<?= $workshop->title() ?>">
<div class="book-3d-top"></div>
<img class="spine-img" src="<?= $workshop->image()->url() ?>" alt="<?= $workshop->title() ?>">
<div class="spine-p-wrapper">
<p><?= $workshop->title() ?></p>
</div>
</li>
</a>
<?php endforeach ?>
<!-- EVENTS -->
<?php foreach ($events as $event): ?>
<a href="<?= $event->url() ?> " class="book-spine-wrapper">
<li class="book-spine draggable" title="<?= $event->title() ?>">
<div class="book-3d-top"></div>
<img class="spine-img" src="<?= $event->image()->url() ?>" alt="<?= $event->title() ?>">
<div class="spine-p-wrapper">
<p><?= $event->title() ?></p>
</div>
</li>
</a>
<?php endforeach ?>
</ul>