1

I need to Display Categories Description.

I create a new file category.php with archives.php template.

i try this function but its not working.

 <?php echo category_description( $category_id ); ?> 

1 Answer 1

1

From the category_description( $category_id ) parameters description:

Category ID. Will use global category ID by default.

This means that if you are intending to use the global id, you don't need to insert the variable $category_id which may be undefined in your use of the function. I'm assuming it is undefined because it is not listed in the global variables. This is the default use of the function which will use the ID of 0:
echo category_description();

Otherwise, if you want the description of a specific category, pass the ID of that category as an argument, such as:

echo category_description( 3 ); //gets the description for category with the ID of 3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.