Created
April 3, 2013 08:51
-
-
Save leanda/5299565 to your computer and use it in GitHub Desktop.
WordPress: Output for the post's categories, building on get_the_category() adds category slug as a class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $sep = ''; | |
foreach((get_the_category()) as $cat) { | |
echo $sep . '<a href="' . get_category_link($cat->term_id) . '" class="cat-' . $cat->slug . '" title="View all posts in '. esc_attr($cat->name) . '">' . $cat->cat_name . '</a>'; | |
$sep = ', '; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment