Hello
I am trying to make it so the admin using the panel can create their own custom name for each section. Currently I’ve successfully created it in the panel, but can’t get it to load in front end of site…
This is my PHP code calling it in the template:
<div class="info-section">
<h2><?= $page->soloLabel()->kirbytext() ?></h2>
<?php if ($page->solo()->isNotEmpty()) : ?>
<?php $items = $page->solo()->toStructure();
foreach ($items as $item) : ?>
<div class="date"><?= $item->year()->html() ?></div>
<div class="type"><a href="<?= $item->url()->html() ?>"><?= $item->text()->html() ?></a>
<?php if ($item->location()->isNotEmpty()) : ?>, <?= $item->location()->html() ?>
<?php endif ?></div>
<?php endforeach ?>
<?php endif ?>
</div>
and this is the way it’s being called in the YML file:
soloLabel:
label: Section Label
type: text
width: 1/4
solo:
label: Section Content
type: structure
fields:
year:
label: Year
type: text
width: 1/4
text:
label: Text
type: text
width: 1/4
url:
label: URL
type: url
width: 1/4
location:
label: location
type: text
width: 1/4
Thanks!