Site logo

Archived topic

Display primary category in Dynamic Data + separator (GenerateBlocks)

8 replies · Started by Dmitrii on July 1, 2022

Viewing posts 1–9 of 9

I'm recreating my homepage based off an existing design and need help in figuring out:

1) How do I display only the primary category when using Dynamic Data (right now it pulls primary + secondary).

I saw a similar post about this topic, but I'm using Rank Math and not Yoast. Here's the post: https://generatepress.com/forums/topic/dynamic-data-in-generateblocks-display-only-primary-category/

2) How do I add an icon/dot that separates my primary category and the published/updated date. For context, I've put both elements (category + date) within a container and set them to inline width.

Hi David!

I added the PHP to my child theme, inserted the shortcode inside a GB Headline Block, and set the Dynamic Data to the correct post, but it's showing both categories.

When I edit the block as HTML this is what I see:

[rank-math-primary-category-shortcode]

What did I do wrong?

Both Yoast and Rankmath use their own custom functions to add Primary categories, so its not a core function that GP can tap into or manipulate.

So if that code isn't working, you will need to ask RankMath support about that.

Thanks David!

You're welcome.

Please let us know what RankMath say

I'm under the free tier for RankMath, so the quality of replies has been pretty underwhelming (issue is not close to being resolved). Going to leave it as is for now and come back to it another day.

Keep us posted, if i find a solution elsewhere ill try and post it here.

Will do!

This archived topic is closed to new replies.