The_category with Excludes - CSS-temppuja

Anonim

WordPress-funktio the_category ei tarjoa poissulkemisparametria. Tämä:

function exclude_post_categories($excl='', $spacer=' ') ( $categories = get_the_category($post->ID); if (!empty($categories)) ( $exclude = $excl; $exclude = explode(",", $exclude); $thecount = count(get_the_category()) - count($exclude); foreach ($categories as $cat) ( $html = ''; if (!in_array($cat->cat_ID, $exclude)) ( $html .= 'cat_ID) . '" '; $html .= 'title="' . $cat->cat_name . '">' . $cat->cat_name . ''; if ($thecount > 0) ( $html .= $spacer; ) $thecount--; echo $html; ) ) ) )

Plus niin kauan kuin sinulla on, voit muuttaa lähtöä haluamallasi tavalla, mikä on mukavaa.

Käyttö on kuin:

Joka luetteloisi kaikki luokat lukuun ottamatta luokkaa, jonka tunnus on 4.