I followed the cookbook on an author’s posting.
It works when the author is in the foreground.
But I can’t reach the author when he is in a structure.
I have a general author (not very useful) and internal authors (in a list) who each write a story for each group (these are bike groups).
I have a general title that must be kept.
This allows us to say that in:
group 1 was written by Henri
group 2 was written by Franck
group 3 was written by Mickael
Code:
$stories = page('sorties/recits')->grandChildren()->listed()->filter(function($child) use($user){
//var_dump($child->listing()->toStructure()->toArray());
return in_array($user->id(), ($child->author()->yaml()));
});
I think you have to manage to reach the author of the list upstream, but I can’t.
Foreach:
<div class="tab-pane fade py-4" id="nav-recits" role="tabpanel" aria-labelledby="nav-profile-tab"
tabindex="0">
<p>
<?= $page->firstname() ?> a écrit <?= count($stories) ?> récit(s).
</p>
<?php if ($stories): ?>
<ul class="list-group list-group-flush">
<?php
foreach($stories as $storie):
//var_dump($storie->listing()->toStructure()->toArray());
?>
<li class="list-group-item"><a href="<?= $storie->url() ?>"><?= $storie->title() ?></a></li>
<?php endforeach ?>
</ul>
<?php endif ?>
</div>