Site logo

Archived topic

How to display category in custom post type Block - Content Template

5 replies · Started by Len on June 24, 2022

Viewing posts 1–6 of 6

The Block - Content Template works for the page with page content and featured image. I want to show the page category.
The block "Post Categories" doesn't show the category for the page.
What block do I use, if not what code do I use in the template, or is there a shortcode. I want to achieve this without editing the actual template file.

Hi there,

you can add either a GB Headline Block or Buttons Block, and set the Dynamic Data options to List of Terms for the current post and select the taxonomy you need eg. Category.

David

Thanks, I would never have thought of that! With an additional step and it works well - see below.
I have used two GB heading blocks both set to DIV, one under each other, then assigned a css class "display-inline" to both. This is then set to display:inline-block, so I now have on one line:
Category: categoryname
with categoryname as the dynamic data bit showing the term for the custom taxonomy of the post.
Thanks again, LenW

As a note: in the Headline Block there is an Inline Width option under the blocks spacing settings that makes them Inline.
Or, whilst you're in a Block Element a Container Block has an option for Inline Meta. And everything in that container is inlined.

Glad to be of help.

David, thanks, I stumbled on the inline settings after I did this post, easier than messing with css.

Glad to hear that!

This archived topic is closed to new replies.