Hi.
My project pages contain filters to show them sorted on other pages.
At the end of each project page I want to show three random related projects.
Is it possible to commit that project tag to ->filterBy()
?
Thanks so far.
Hi.
My project pages contain filters to show them sorted on other pages.
At the end of each project page I want to show three random related projects.
Is it possible to commit that project tag to ->filterBy()
?
Thanks so far.
Yes, sure, just pass the tag to filterBy()
:
<?php
$related = $page->siblings()->filterBy('tag', $page->tag())->shuffle()->limit(3);
You might have to use $page->tag()->value()
if the above code does not work.