Custom input for section label in panel for admin use, trouble calling it in front end

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!

Hm,you mean this line <?= $page->soloLabel()->kirbytext() ?> doesn’t output anything, but the rest works fine?

Personally, I wouldn’t use kirbytext() but html() here, but that’s another story.


On a side note:
Please use three backticks before and after codeblocks to format your code as code.

It also helps readability if you properly indent your code and put control structures on their own lines. Thank you!

OK thank you, will do. and will use html instead.