[Resolved] Display primary category in Dynamic Data + separator (GenerateBlocks)

Home Forums Support [Resolved] Display primary category in Dynamic Data + separator (GenerateBlocks)

Home Forums Support Display primary category in Dynamic Data + separator (GenerateBlocks)

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #2270797
    Dmitrii

    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.

    #2271013
    David
    Staff
    Customer Support

    Hi there,

    1. i found this on the RankMath support for creating a shortcode to display the primary category:

    https://support.rankmath.com/ticket/call-blog-primary-category/#post-279421

    The shortcode can be added inside a GB Headline Block.

    2. You could add a dot icon to the second post meta headline block.

    #2271542
    Dmitrii

    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?

    #2271648
    David
    Staff
    Customer Support

    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.

    #2271649
    Dmitrii

    Thanks David!

    #2271680
    David
    Staff
    Customer Support

    You’re welcome.

    Please let us know what RankMath say

    #2275595
    Dmitrii

    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.

    #2275856
    David
    Staff
    Customer Support

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

    #2275879
    Dmitrii

    Will do!

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.