Revision: 31592
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 9, 2010 07:04 by vagrantradio
Initial Code
//template call
<?php echo the_category_exclude(", ","featured,uncategorized,other,news,articles"); ?>
//functions file
function the_category_exclude($separator=', ',$exclude='') {
$toexclude = explode(",", $exclude);
$newlist = array();
foreach((get_the_category()) as $category) {
if(!in_array($category->category_nicename,$toexclude) && ($category->category_parent == 0)){
//$newlist[] = $category->cat_name;
$newlist[] = '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a>';
}
}
return implode($separator,$newlist);
}
Initial URL
Initial Description
Exclude category slugs, only shows parent cats.
Initial Title
WordPress Exclude Category Slugs
Initial Tags
wordpress
Initial Language
PHP