Created
August 5, 2010 11:03
-
-
Save quis/509562 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<? | |
// Post category listing with support for exclusion | |
// $separator is a string, $excluded is an array of category slugs to be excluded from the list | |
// Sample call: | |
// echo the_category_exclude(" · ", array("hidden", "admin")); | |
function get_the_category_exclude($separator, $excluded = array("")) { | |
foreach ( | |
get_the_category() | |
as | |
$category | |
) { | |
if (!in_array($category->cat_name, $excluded)) { | |
$output[] = "<a href=\"" . get_category_link($category->term_id) . "\" title=\”View all posts in " . $category->name . "\”>" . $category->name . "</a>"; | |
} | |
} | |
return implode($separator, $output); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment