Display Category description in WordPress
If you want to add a category description to the category page, you need to open a file that displays categories in your theme, usually this is a file archive.php or category.php and add this code to it
1 2 3 |
<?php echo category_description(get_the_category()[0]->cat_ID); ?> |
Also you can use function in file functions.php
1 2 3 4 5 |
function cat_description(){ if ( is_category() ){ echo category_description(get_the_category()[0]->cat_ID); } } |
To display category description on any page write
1 |
echo cat_description(); |