Tag Archives: categories

WordPress: Custom Category Lists

WordPress has a category list widget which you can use to show all the used categories on your blog, you can even style it via CSS to make it pretty but sometimes designers like to make it hard for you and be all ” no don’t use images, because then we need to scale them for iPhone & iPad retina display, just use a symbols font for that! ” Crazy.

So heres a categories list, just like the widget, but you can style it or change the HTML in any way you like!

$args = array(‘orderby’ => ‘name’, ‘order’ => ‘ASC’);
$categories = get_categories($args);
foreach($categories as $category) {
echo ‘

  • ) ‘.$category->cat_name.’
  • ‘;

    via Inigo Media

    WordPress: Custom Post Type Categories

    $orderby = ‘name’;
    $show_count = 1; // Show count? 1/0
    $pad_counts = 0; // Pad counts? 1/0
    $hierarchical = 1; // Hierarchical 1/0
    $taxonomy = ‘directory_category’; // CPT Taxonomy Name
    $title = ”; // Widget Title
    $args = array(
    ‘orderby’ => $orderby,
    ‘show_count’ => $show_count,
    ‘pad_counts’ => $pad_counts,
    ‘hierarchical’ => $hierarchical,
    ‘taxonomy’ => $taxonomy,
    ‘title_li’ => $title
    echo ‘

      echo ‘


    I was searching for a categories widget for custom post types in WordPress but couldn’t find one, so here is a quickly hashed together one. Enjoy.