/** * Prints HTML with category and tags for current post. * * Create your own twentysixteen_entry_taxonomies() function to override in a child theme. * * @since Twenty Sixteen 1.0 */ function twentysixteen_entry_taxonomies() { $categories_list = get_the_category_list(_x(', ', 'Used between list items, there is a space after the comma.', 'twentysixteen')); if ($categories_list && twentysixteen_categorized_blog()) { printf('<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Categories', 'Used before category names.', 'twentysixteen'), $categories_list); } $tags_list = get_the_tag_list('', _x(', ', 'Used between list items, there is a space after the comma.', 'twentysixteen')); if ($tags_list) { printf('<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Tags', 'Used before tag names.', 'twentysixteen'), $tags_list); } }
function twentysixteen_entry_taxonomies() { $categories = get_the_category(); $separator = ' '; $categories_list = ''; if ($categories) { foreach ($categories as $category) { if ($category->name != "Uncategorized") { $categories_list .= '<span class="post-category"><a href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s"), $category->name)) . '">' . $category->cat_name . '</a></span>' . $separator; } } } if ($categories_list && twentysixteen_categorized_blog()) { printf('<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Categories', 'Used before category names.', 'twentysixteen'), $categories_list); } $tags_list = get_the_tag_list('', _x(' ', 'Used between list items, there is a space after the comma.', 'twentysixteen')); if ($tags_list) { printf('<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Tags', 'Used before tag names.', 'twentysixteen'), $tags_list); } }