Display select option name

Hi,

I’m trying to display the name from a select field.

fields:
  category:
    label: Category
    options:
      fix: Fix
      improvement: Improvement
    type: select

Below code shows “fix” or “improvement” but I’m trying to get the name “Fix” and “Improvement”.

<?= $article->category() ?>

Appreciate the help!

Either change your blueprint:

fields:
  category:
    label: Category
    options:
      Fix: Fix
      Improvement: Improvement
    type: select

Or do it via code in your template: <?= str::ucfirst($article->category()) ?>


Edit: if you change your blueprint, you’ll have to loop through all your existing content and re-save it.

1 Like

Thanks for helping me out!