Created
October 24, 2013 18:15
-
-
Save quagliato/7142312 to your computer and use it in GitHub Desktop.
Print categories of a post, with links
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 | |
$cats = get_the_category(get_the_id()); | |
$separator = ', '; | |
$output = ''; | |
foreach($cats as $cat){ | |
$output = | |
'<a href="'. | |
get_category_link($cat->term_id). | |
'" title="'. | |
esc_attr(sprintf(__("Veja todos os posts em %s"), $cat->name)). | |
'">'. | |
$cat->name. | |
'</a>'. | |
$separator; | |
echo trim($output, $separator); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment