WP current-cat in single posts

das wordpress plugin fügt single posts bzw. der wp_list_categories funktion die fehlende css klasse “current-cat” hinzu. die class “current-cat” ist somit auch in artikeln / single posts verfügbar.

installation
versions
  • 1.02 – Fix a Special Char Error
  • 1.01 – just scipted
alternative

direkt im template nutzbar – quick’n dirty and working.


if (is_single() && !is_page())
{
$current_post = @get_post(get_the_ID(),OBJECT);
$current_cat = @get_the_category($current_post->ID);
wp_list_categories('title_li=&current_category='.$current_cat[0]->cat_ID);
}
else
{
wp_list_categories('title_li=');
}

18.09.2009