• Hi, I had been trying to list the categories with their descriptions (in “ul” unordered list).

    <u>Example:</u>

    Category 1 Link >> This is a description of Category 1
    Category 2 Link >> This is a description of Category 2
    Category 3 Link >> This is a description of Category 3

    ….

    Currently, I have only been able to use the wp_list_categories function and use the cat_description as the title attribute but haven’t found a plugin for the above.

Viewing 3 replies - 1 through 3 (of 3 total)
  • <ul>
     <?php
      $categories=  get_categories();
      foreach ($categories as $cat) {
    	echo '<li>'.'<a href="'.get_category_link($cat->cat_ID).'">'.$cat->description.'</a>'.'</li>';
      }
     ?>
    </ul>

    Outrix’s solution didn’t work for me. Here’s what did work for me (I hate dealing with unordered lists):

    <?php
    $categories = get_categories();
    foreach ($categories as $cat) {
    	if ($cat->category_parent != 0) {
    		echo '<span style="padding-left:10px;">';
    	}
    	echo '<a href="'.get_option('home').get_option('category_base').'/'.$cat->category_nicename.'/">'.$cat->cat_name.'</a> ('.$cat->category_count.')';
    	if ($cat->category_description != '') {
    		echo ' - '.$cat->category_description;
    	}
    	if ($cat->category_parent != 0) {
    		echo '</span>';
    	}
    	echo '<br />';
    }
    ?>

    This was quite what i was looking for, thank you guys!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘List WordPress Categories with Cat Descriptions’ is closed to new replies.