You can use the function get_the_category_list() for this process.

<?php
$categories = get_the_category();
$separator = ' ';
$output = '';
if($categories){
	foreach($categories as $category) {
		$output .= '<a href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '">'.$category->cat_name.'</a>'.$separator;
	}
echo trim($output, $separator);
}
?>

For more : http://codex.wordpress.org/Template_Tags/get_the_category

Leave a Reply

Your email address will not be published. Required fields are marked *