Black Friday Sale! Get up to $40 off GP Premium!Learn more

[Resolved] How to get Category description to display links and images?

Home Forums Support How to get Category description to display links and images?

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #142142
    Fernando

    Hello!

    First of all, I love GeneratePress. So versatile, clean, and efficient.

    I have created categories as my main menu navigation pages. I added text description and it was displayed perfectly. I then added the CategoryTinymce plugin so I could add links and images in my Category descriptions. Nothing is displayed though.

    How can I solve this issue? I would like each category page to have its own description, images and links.

    Thank you so much, I really appreciate your time.

    #142152
    bdbrown

    Hi Fernando. If you downloaded that CategoryTinymce plugin from the WP plugin repository I don’t think there are any guarantees that it will work. As the author stated a year ago in his sticky post on the plugin support forum:

    I have no plans to update this plugin.
    No further support will be offered to this plugin. Hopefully someone else will develop a replacement plugin.
    There are too many WordPress updates that happen for me to commit any time to maintaining any of my plugins.

    The author does provide paid support on his website at http://wp.ypraise.com/.

    If you can post a link to your site I’ll take a look but don’t know that I’ll be able to fix it.

    #142155
    Fernando

    Thanks for answering bdbrown.

    My website is http://www.ginytonic.com

    Do you know any other plugins/methods of enabling links and images in category descriptions?

    Thanks in advance.

    #142167
    bdbrown

    The only category archive page I see is Prueba Soundcloud. The description on that page looks like the default category description. Is the plugin active? You can, I believe, add links directly to the default category description by inserting an anchor tag. Not sure about the images. Might be something you could do with the pre_get_posts() function in a child theme; I’d have to do some more checking on that.

    #142168
    Tom
    Lead Developer
    Lead Developer

    I think the category description field allows HTML.

    For links: A link to GeneratePress

    For images: <img src="URL TO YOUR IMAGE" alt="" />

    Worth a shot 🙂

    #142185
    bdbrown

    The anchor tag works but apparently the img tag gets stripped out.
    Here’s a plugin that should help:
    https://wordpress.org/plugins/allow-html-in-category-descriptions/

    #142215
    Tom
    Lead Developer
    Lead Developer
    #142433
    Fernando

    Thanks bdbrown! I am sorry I did not specify where my category page was ( Its called Prueba Soundcloud under Audio menu and only visible when Spanish language is selected.

    I downloaded the plugin and tried the anchor tag, and still couldn’t get it to display the anchor tag. The results are shown on the page.

    Do you think you could take a look at this?

    Thank you so much.

    #142461
    bdbrown

    I don’t think you need any of the document structure tags and you shouldn’t even need the plugin for just the anchor tag. You should be able to enter something like this into the category description:

    Estaría increible si la descripción se viera aquí. <a href="http://www.w3schools.com">Visit W3Schools.com!</a>
    

    And it should end up being displayed like this:

    Estaría increible si la descripción se viera aquí. Visit W3Schools.com!

    If it doesn’t work that way, the only thing I can think of would be something in the language translation that’s keeping it from correctly interpreting the tag. But that’s just a guess.

    Another option that might work (and Tom can confirm this) is to leave the category description blank, then use the “generate_after_archive_title” hook and enter your links and images there based on the category. Actually that might be an even better idea as then you have it all centralized in one place. Just a thought.

    #142467
    Tom
    Lead Developer
    Lead Developer

    Let me know if the above doesn’t work I can show you how to use the hook @bdbrown mentioned. It involves some PHP, but should be mostly copy/paste once I give the code to you 🙂

    #142524
    Fernando

    Thanks so much for your help bdbrown, unfortunately it didn’t work, its probably something to do with the translation as you say.

    Tom would you be so kind to help me with the hook?

    Thanks!

    #142594
    Tom
    Lead Developer
    Lead Developer

    You can use a function like this:

    add_action( 'generate_after_archive_title','generate_add_category_descriptions' );
    function generate_add_category_descriptions()
    {
        // First category - assuming the category ID is 10
        if ( is_category( 10 ) ) : ?>
            Anything and everything can go in here. Including links and images.
        <?php endif;
    
        // Second category - assuming the category ID is 20
        if ( is_category( 20 ) ) : ?>
            Anything and everything can go in here. Including links and images.
        <?php endif;
    
        // Third category - assuming the category ID is 30
        if ( is_category( 30 ) ) : ?>
            Anything and everything can go in here. Including links and images.
        <?php endif;
    }

    Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

    You just need to find the ID of each category, and then add your content 🙂

    #142598
    Fernando

    Thank you so much Tom, I will gladly give this a try and let you know if it works.

    Have an excellent day.

    #142605
    Tom
    Lead Developer
    Lead Developer
    #143753
    Fernando

    Issue resolved, it worked! Thank you so much for your help bdbrown and Tom.

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