You may have noticed in some WordPress themes that category menu bar also display category description text. By default wp_list_categories function will display only category links. In this tutorial I will show you how to build a category menu with description text.

Step 1
Copy paste following codes in header.php of your wordpress theme.

<div id="wpyagnav">
<ul class="wpyagcat">
<?php
$args=array(
);
$categories=get_categories($args);
foreach($categories as $category) {
echo '<li><strong><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a></strong>';
echo '<br />'. $category->description . '</li>';
}
?>
</ul>
</div>

Step 2
Add following CSS codes in style.css of your wordpress theme.

#wpyagnav{
height: 61px;
background: #d0d0d0;
margin-left: auto;
margin-right: auto;
width: 980px;
}

ul.wpyagcat{
padding-top: 11px;
}

ul.wpyagcat li{
display: inline;
float: left;
position: relative;
margin-left: 18px;
text-align: center;
}

Our category menu with description text is ready.

Passionate webdesigner since 2006, love to help entrepreneurs become successful. Musician | skiing | dogs | www.wordpressentials.com

1 COMMENT

  1. Thanks for the code! I spent hours & hours on the internet looking for the solution… It really helped me a lot!
    I’m just wondering if it’s also possible to display the number of articles for each category? (Featured (1), Technology (2)).
    I used to do it with the parameter “show_count” but I’m not sure it can work here…
    Thanks a lot!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

18 + eighteen =