[Support request] Blog Category description not showing

Home Forums Support [Support request] Blog Category description not showing

Home Forums Support Blog Category description not showing

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1312487
    Dominic

    Hi,

    We want to write text on our blog post categories under the field description.
    This text when entert is not showing on the front end of the category.

    See what I mean: https://www.screencast.com/t/xeWte4m02

    How can we fix this?

    Thank you for your help

    Kind regards,
    Dominic

    #1312959
    Leo
    Staff
    Customer Support

    Hi there,

    That’s because a header element is being used.

    I think this is the best solution:
    https://docs.generatepress.com/article/header-element-template-tags/#custom_field-name

    #1313023
    Dominic

    Hi Leo,

    thanks for the feedback.

    Not being a developer I have no idea what to do with the {{custom_field.name}}

    How should I use this and where?

    Thank you for your time and help.

    Kind regards,
    Dominic

    #1313027
    Leo
    Staff
    Customer Support

    Let’s try this method.

    Add this code:

    add_shortcode( 'term_description', 'tu_term_description' );
    function tu_term_description() {
        ob_start();
        echo term_description( get_queried_object()->term_id, 'category' );
        return ob_get_clean();
    }

    Using one of these methods:
    https://docs.generatepress.com/article/adding-php/

    Then add the shortcode:
    [term_description]

    To the header element.

    Let me know if this helps ๐Ÿ™‚

    #1315094
    Dominic

    -Using the code I get an error in code snippets
    2020-06-04_1127

    It’s probably a syntax error but I don’t know enough of PHP to fix it.
    2020-06-04_1123

    I’ve added the short code to the Global Header element that also All Archives as location.

    Thank you for your time and help

    #1315386
    David
    Staff
    Customer Support

    Hi there,

    i update Leos code above.

    #1315432
    Dominic

    thanks
    this works ๐Ÿ™‚

    It only doesn’t display where I want it
    2020-06-05_1454

    Tried it as a hook in the “before main content” but then it just displays the actual shortcode.

    How should I proceed?

    thanks again for all the help

    #1315497
    David
    Staff
    Customer Support

    Make sure to check the Execute Shortcodes option in the Hook Element

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