Může se hodit, když nechceme zobrazovat např. nadřazenou rubriku, ale jen podrubriky. Umístíme do functions.php.
/—code php
function the_category_filter($thelist,$separator=‘ ‚) {
// seznam ID rubrik, které se nemají zobrazit
$exclude = array(4, 5);
// create an empty array
$exclude2 = array();
// loop through the excluded IDs and get their actual names
foreach($exclude as $c) {
// store the names in the second array
$exclude2[] = get_cat_name($c);
}
// get the list of categories for the current post
$cats = explode($separator,$thelist);
// create another empty array
$newlist = array();
foreach($cats as $cat) {
// remove the tags from each category
$catname = trim(strip_tags($cat));
// check against the excluded categories
if(!in_array($catname,$exclude2))
// if not in that list, add to the new array
$newlist[] = $cat;
}
// return the new, shortened list
return implode($separator,$newlist);
}
add_filter(‚the_category‘,’the_category_filter‘, 10, 2);
\—