Skip to main content

WordPress – How to Display Category Name and Description in Theme

Submitted by admin on Sun, 12/12/2021 - 11:19
In this WordPress tutorial we will see how to print or display category / archieve name and description in your WordPress theme.

How To Display Category Name

Use below code to print category / archieve name in your WordPress theme.

the_archive_title( '<h1 class="archive-title">', '</h1>' )

In above code you can change class and heading tag.

How To Display Category Description

Use below code to print category / archieve description in your WordPress theme.

the_archive_description( '<div class="archive-description">', '</div>' )

In above code you can change class of div.

We generally put these codes in archieve.php of a WordPress theme to display category name and description. This is full code to display both category name and description.

<header class="page-header text-center section">
  the_archive_title( '<h1 class="category-title">', '</h1>' );
  the_archive_description( '<div class="category-description">', '</div>' );

How to add description to a category

Navigate to:
WordPress Dashboard arrow Posts arrow Categories

Click Edit link of the category of which you want to add description. on next page you can add description to this category. See below image.


Hope this article was helpful to you.


Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.