Blog Changelog August 2017

Reading Time: 0 minute, 11 seconds
  • Related Posts unter jedem Beitrag hinzugefügt.

Code:

<?php
$tags = $page->tags()->split(',');
$children = page('blog')->children()->visible();
$relatedPages = $children->filter(function($child) use($tags) {
          if (array_intersect($child->tags()->split(','), $tags)) {
            return $child;
          }
       });
?>
<ul>
<?php foreach($relatedPages->not($page)->shuffle()->limit(3) as $related): ?>
  <li><a href='<?php echo $related->url(); ?>'><?php echo $related->title(); ?></a></li>
<?php endforeach ?>
</ul>