Hey there,
I want to show related pages, hand-picked via structure field entries. So far I successfully dodged all errors on the way and ended up with this:
# blueprint file
title: Post
pages: false
fields:
# ...
related:
label: Related posts
type: structure
fields:
post:
label: Post
type: select
options: siblings
// template file
<?php foreach($page->related()->toStructure() as $related) : ?>
<?php
$uri = $related->post()->value();
$post = $page->siblings(false)->find($uri);
?>
<li>
<h3>
<a href="<?= $post->url() ?>">
<?= $post->title()->html() ?>
<small><?= $post->date('d M Y') ?></small>
</a>
</h3>
</li>
<?php endforeach ?>
Now, everything’s fine so far, except as entry
of the structure field, I’d like to show the real title (of the “selected” page), not the uri - that possible?