Display category description in WordPress theme

Display category description in WordPress theme

Should you ever need to display the category description in your WordPress theme, and it doesn’t show after you save the category, then you should modify the theme files so it can display it for you.

1. Edit the category.php file

Go to /wp-content/themes/your-theme-name/ and look for category.php file. If it doesn’t exist then look for archive.php file, and if that one doesn’t exist either then open the index.php file in your preferred text editor.

Insert the following code where you want the description to appear (mostly on top of the page):

<?php 
the_archive_description( '<div class="taxonomy-description">', '</div>' ); 
?>

2. Enable the HTML usage in category description

If you are using older version of WordPress for some reason and therefore you lack the option of using the HTML in category description, then open the functions.php file in text editor and paste the following code after the opening <? php statement:

remove_filter('pre_term_description', 'wp_filter_kses');

Now you can insert whatever HTML you like in your description box.

Apendix

If you want to display the category description in other parts of your website, then you can also use the category_description template tag:

<?php echo category_description(category ID number); ?>

NOTE: Replace “category ID number” with your actual category ID number.

By janoshke

Web developer and IT consultant. Freelancer with full respect for OpenCart and WordPress. Gamer, (ex)drummer and parent.

4 comments

    1. Hello.
      If by “this” you mean to insert the description on each category through Posts > Categories, then YES.
      This post describes how to enable the displaying of the category decription field through your theme if it doesn’t display in the first place. Many themes ignore this field for some reason, and yet sometimes we need to have it on the front-end.
      I hope this makes sense 🙂

      Cheers

  1. Hey!! You are the best. Your suggeston only helped. I did not have category.php nor archive.php finally changed the index.php in Gillion Theme
    Now I can see the descriptions

    Thanks!!

    But any idea how to get my Carousel EDITED?
    I was away from my blog for some time and seems things have changed and so I am not able to see where to Edit what POSTS I want to see in carousel.

    This is on my home page.

    Earlier I was able to edit the top part – don’t remember if it was called carousel or came with gillion by default or I added something else. I can only see A BLOCK iN WPBAKERY EDITOR but when I click Edit I see these codes only

    [vcg_blog_slider style=”style2″ limit=”8″ dots=”true” uppercase=”true” autoplay=”true” autoplay_speed=”3″]

    But no scope for adding POSTS ID as earlier I definitely remember it to have.
    Where is it now?
    Or what has changed?

    Even if I delete this block and add a new carousel Element I am not able to find a good one which i can customise. (Ohh i want free 🙂 though gillion i actually bought licence.

Leave a Reply