Display Category Name
-
How can I display a posts category? I’ve been trying to add to top-10.php code but nothing seems to work. I tried:
$output .='<a href="' . $category->cat_ID . '" rel="category tag">' .$category->cat_name. '</a>'And
$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); }Neither works. Can you please help me out? Thanks!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Display Category Name’ is closed to new replies.