print_categories_of_a_post_with_links.php

<?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); } ?>
Print categories of a post, with links

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.