Site logo

[Resolved] How to display category description on category page (header merge active)?

Home Forums Support [Resolved] How to display category description on category page (header merge active)?

Home Forums Support How to display category description on category page (header merge active)?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1920212
    Matt

    Hi there, I have the same issue as described here: here

    I have added a category description but it’s not displaying because of a custom page hero. So I have created a custom page hero just for categories but would like to show the description underneath the posts, if possible?

    #1920262
    David
    Staff
    Customer Support

    Hi there,

    if you want it displayed below the posts, then create a new Block Element, design the layout like you did for the hero.
    To display the description, add a GP Dynamic Content Block, and from its options select Term Description.

    NOTE: The GP Dynamic Block doesn’t have style controls, but it will inherit any typography / color settings you add to the Container Block it sits inside of.

    The Hook to display below post is the after_main_content

    https://docs.generatepress.com/article/hooks-visual-guide/

    #1920655
    Matt

    It worked the first time. Genius, thank you!! 🙂

    #1920831
    David
    Staff
    Customer Support

    Glad to be of help!

    #1928629
    Matt

    Wanted to come back to this to ask if it’s possible to only have the category text on the first page, to avoid dupe content issues on /page/2/ /page/3/ etc ?

    #1929361
    Ying
    Staff
    Customer Support

    Hi Matt,

    You can try this PHP snippet:

    add_filter( 'generate_block_element_display', function( $display, $element_id ) {
        if ( 100 === $element_id && is_paged() ) {
            $display = false;
        }
    
        return $display;
    }, 10, 2 );

    Replace the 100 with your block element ID which can be found in the URL of the block element:
    https://www.screencast.com/t/BkrLmjoVZ

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    Let me know if this helps 🙂

    #1929809
    Matt

    Thanks Ying, where would I add that php snippet?

    Edit: Added in functions.php on child theme, worked great thanks!

    #1930422
    Ying
    Staff
    Customer Support

    Great! Glad you figured it out 🙂

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