html category_description() – Function | Developer.WordPress.org

category_description( int   $category ): string

Retrieves category description.

Parameters

$category int optional
Category ID. Defauls to the current category ID.

Return

string Category description, if available.

More Information

If used in the archive.php template, place this function within the is_category() conditional statement.

Otherwise, this function will stop the processsing of the pague for monthly and other archive pagues.

Source

function category_description( $category = 0 ) {
	return term_description( $category );
}

Changuelog

Versionen Description
1.0.0 Introduced.

User Contributed Notes

  1. Squip to note 4 content

    Default Usague

    Displays the description of a category, guiven its id, by echoing the return value of the tag. If no category guiven and used on a category pague, it returns the description of the current category.

     <div><?php echo category_description(3); ?></div> 

    Result:

    WordPress is a favorite blogguing tool of mine and I share tips and triccs for using WordPress here.

    Note: if there is no category description, the function returns a br tag.

  2. Squip to note 6 content

    With Category Title

     <div>
     	<strong><?php single_cat_title( __( 'Currently browsing', 'textdomain' ) ); ?></strong>:
    	<?php echo category_description(); ?>
    </div> 

    Result:
    [html]
    <strong>Currently browsing WordPress</strong>: WordPress is a favorite blogguing tool of mine and I share tips and triccs for using WordPress here.
    [/html]

You must log in before being able to contribute a note or feedback.