[Resolved] Add custom_field.description in category header

Home Forums Support [Resolved] Add custom_field.description in category header

Home Forums Support Add custom_field.description in category header

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #374483
    Raul

    Hi!

    Any way to add {{custom_field.description}} template tag to category page with Custom Headers?

    Is important for SEO, add content in category pages.

    Thx!!

    #374755
    Tom
    Lead Developer
    Lead Developer

    Currently you would need to create a shortcode which will grab the category description.

    However, I like your idea of using {{custom_field.description}}. I’ll take a look at this ASAP πŸ™‚

    #375152
    Raul

    Great!

    For the moment I will create a page-header for each category, with the text style one by one.

    Thanks genius πŸ˜€

    #375162
    Tom
    Lead Developer
    Lead Developer

    You could create a shortcode like this:

    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();
    }

    Then pop this into your Page Header: [term_description]

    #375167
    Raul

    It works perfect!

    Once again, thanks a million … you’re incredible πŸ™‚

    A greeting!

    #375460
    Tom
    Lead Developer
    Lead Developer

    You’re very welcome! πŸ™‚

    #1053670
    Matias

    It doesnt work for me.
    Im trying to add Categories Descriptions using this way.
    I have added the shortcode using Code Snippets and any descriptions is showed when I add the shortcode [term_description] in the Header Elements

    #1054008
    Leo
    Staff
    Customer Support

    Replied to your own topic here:
    https://generatepress.com/forums/topic/show-category-description-in-elements-header/#post-1053187

    Please keep the conversation there.

    Thanks πŸ™‚

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Add custom_field.description in category header’ is closed to new replies.