quagliato
10/29/2013 - 3:56 PM

Iterate all categories and prints its links.

Iterate all categories and prints its links.

<?php
     $args = array(
          'type' => 'post',
          'child_of' => 0,
          'parent' => '',
          'orderby' => 'ID',
          'order' => 'ASC',
          'hide_empty' => 0,
          'taxonomy' => 'category',
          'exclude' => 1);
     $categories = get_categories($args);

     foreach($categories as $category){
          $item = '<a href="';
          $item .= get_bloginfo('url');
          $item .= '/category/';
          $item .= $category->slug;
          $item .= '">';
          $item .= $category->name;
          $item .= '</a><br />';

          echo $item;
     }
?>