Ashley Cameron Design

Ashley Cameron Design

List all SubCategories

SnippetsWordPress

About a 1 minute read

"It is the supreme art of the teacher to awaken joy in creative expression and knowledge."

Albert Einstein


1
2
3
4
5
6
7
8
9
10
11
$echo = '<ul>' . "n";
$childcats = get_categories('child_of=' . $cat . '&hide_empty=1');
foreach ($childcats as $childcat) {
    if (1 == $childcat->category_parent) {
        $echo .= "t" . '<li><a href="' . get_category_link($childcat->cat_ID).'" title="' . $childcat->category_description . '">';
        $echo .= $childcat->cat_name . '</a>';
        $echo .= '</li>' . "n";
    }
}
$echo .= '</ul>' . "n";
echo $echo;