Get the list of categories to which the article belongs
<?php // Get the list of categories to which the article belongs
$categories = get_the_category();
$separator = ", ";
$output = '';
if($categories) {
foreach($categories as $category) {
$output .= '<a href="'.
get_category_link($category->term_id).'">'.
$category->cat_name .'</a>'.$separator;
// $output .= $category->cat_name . $separator;
}
}
echo trim($output, $separator);
?>