Type label of current Post


I’m able to get the type name of the current Post using <Field type />, which outputs page if it’s a page.
But how do i get the type label: Page (with a capital)?

I love easy L&L questions! :smile: I mean I like difficult ones too, but it’s nice not to need to troubleshoot for hours to find an answer hahaha. You’re going to want to use the Format tag:

<Format case=pascal>
  <Field type />

Oops, I was too quick, I just realized that I didn’t quite answer your question. You weren’t looking for how to capitalize it, you were looking for the actual label. It looks like that doesn’t exist as a post/page field, and unfortunately the type loop doesn’t seem to allow setting a query parameter to only loop through the current post. Unless there’s some undocumented query parameter that I wasn’t able to find.

I was able to make this, which technically works, but it seems pretty unwieldy for such a simple task:

<Set type_name><Field type /></Set>

<Loop type=type>
  <If check="{Format case=lower}{Field label}{/Format}" value="{Get type_name}">
    <Field label />

Hi @benjamin,

Ah ah, what a simple question can trigger.

I like your simple solution #1, it will do the trick given my Post Types have similar names and labels except the capital.

Applause for your solution #2, what an acrobatic! :grin:

1 Like