I can’t work out what is going wrong here and I get an error when trying to use
<?php if ($selected->url()->isNotEmpty()): ?>My code
<?php $projects = $page->projects()->toStructure(); ?>
<?php foreach($projects as $project): ?>
<?php $selected = $project->project()->toPage(); ?>
<a href="<?= $selected->url() ?>">
// Stuff here
</a>
<?php endforeach ?>
Blueprint:
projects:
label: Featured Projects
type: structure
width: 1/2
fields:
project:
type: pages
layout: list
options: query
query: site.find('projects').children.listed
max: 1