Support » Plugin: WP Knowledgebase » Add KB Categories & Tags to Articles

  • Resolved cocool

    (@cocool)



    Hi,

    Thanks for a great plugin!

    Is it possible to make Article Categories & Tags show at the bottom of the individual Article page. Like Post categories, tags, date (meta data) show at the bottom of WP posts?

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Maeve Lander

    (@enigmaweb)

    Yes that would be easily achieved by adding the appropriate template tags to the article template.

    From the FAQs:

    In the plugin’s root directory you will find a folder called /template. You can override that folder and any of the files within, by copying them into your active theme and renaming the folder to /yourtheme/wp_knowledgebase

    The template file for the Knowledgebase post is called single-kbe_knowledgebase.php

    Hi,
    Thanks for your reply.

    Could you pls clarify this (I am not an expert):

    1-adding the appropriate template tags to the article template
    => what are the template tags in this case? Is this a code to be inserted in the file single-kbe_knowledgebase.php and, if so, what code and where?

    2- You can override that folder and any of the files within, by copying them into your active theme and renaming the folder to /yourtheme/wp_knowledgebase
    => pls explain. Do i simply create a new folder called wp_knowledgebase in my current (or child?) theme and add the above modified file single-kbe_knowledgebase.php?
    Does this file have to be in a sub folder called /template?
    like:
    /mytheme/wp_knowledgebase/template/single-kbe_knowledgebase.php

    • This reply was modified 2 months, 3 weeks ago by  cocool.

    Ok, I have added a folder to my theme named wp_knowledgebase and inserted a copy of the file single-kbe_knowledgebase.php.
    => /mytheme/wp_knowledgebase/single-kbe_knowledgebase.php

    I have tested a few changes and they are taken into account.

    All I need now is if you could simply give me the code to be inserted in the single-kbe_knowledgebase.php file so that the tags and categories show below the articles.

    As mentioned, I am not an expert and would really appreciate a hint 🙂

    Thanks a lot!

    • This reply was modified 2 months, 2 weeks ago by  cocool.

    To display the tags in the knowledgebase article it should be enough to add <?php the_tags; ?> to the single-kbe_knowledgebase.php file. When I do that I can see the tags and they are all linked. But the link points to /tag/hashtag/ which is where the ”normal” tags are. And since the site doesn’t have any blog posts the result page only says ”Sorry, no content matched your criteria.” How do I point to the ”real” knowledgebase tags?

    Plugin Author Maeve Lander

    (@enigmaweb)

    WP Knowledgebase posts sit in a custom post type so the_tags() and related functions will not work. You must use the_terms() and its related functions.

    https://codex.wordpress.org/Function_Reference/the_terms
    https://codex.wordpress.org/Function_Reference/wp_get_post_terms

    Great! Thanks Maeve!

    So after some digging I found out that ‘kbe_tags’ shows tags and ‘kbe_taxonomy’ shows categories.

    I added this in single-kbe_knowledgebase.php to show the tags in an unordered list:

    <p>Tags:<br /><?php the_terms( $post->ID, 'kbe_tags', '<ul><li>', '</li><li>', '</li></ul>' ); ?></p></div>

    • This reply was modified 2 weeks, 5 days ago by  . Reason: Code
    Plugin Author Maeve Lander

    (@enigmaweb)

    Thanks for sharing your solution @pelles – that’s super helpful for others 🙂

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