This may not be the best way to accomplish this, but I’m trying to retrieve the first article from a particular section to publish to the homepage. I’ve set this up via a “Home” checkbox on the article page. Right now there are two articles published to the homepage and when the ->first()
is removed from the code below, it correctly display both titles. I’m just trying to display the first article. Any ideas?
<?php foreach(page('talk-and-listen')->children()->visible()->sortBy('date', 'desc') as $child): ?>
<?php if($child->home()->bool()): ?>
<?php echo $child->first()->title()->html() ?>
<?php endif ?>
<?php endforeach ?>