Skip to content

Instantly share code, notes, and snippets.

@taniarascia
Created October 27, 2015 00:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taniarascia/8c78bebeb54dd68d08ad to your computer and use it in GitHub Desktop.
Save taniarascia/8c78bebeb54dd68d08ad to your computer and use it in GitHub Desktop.
Add category to post
<?php
foreach((get_the_category()) as $category) {
if ($category->cat_name != 'Uncategorized') {
echo '<a class="category-block" href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> '; }}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment