Lieben Dank, hast mir super weitergeholfen...
Habs noch etwas modifiziert, da ich nicht bei jeder Kategorie die Anzahl der Kommentare sondern manchmal auch die Anzahl der Beiträge ausgeben will...
PHP
<ul>
<?php
$ausgabe = '';
$allcats = get_categories();
if( $allcats ) {
foreach( $allcats as $categoryloop ) {
$catnum = '';
$catposts = get_posts('numberposts=-1&category=' . $categoryloop->cat_ID );
foreach( $catposts as $catpost ) {
$catnum = $catnum + get_comments_number( $catpost->ID );
$catentry = '';
}
$cat_name = attribute_escape( $categoryloop->cat_name );
$link = '<a href="' . get_category_link( $categoryloop->cat_ID ) . '" ';
$link .= 'title="' . sprintf(__( 'View all posts filed under %s' ), $cat_name) . '"';
$link .= '>';
$link .= $cat_name . '</a>';
if($catpost->ID!=12)
{
$ausgabe .= '<li class="cat-item cat-item-' . $categoryloop->cat_ID . '">' . $link . ' <span class="counter" >(' . $catnum . ')</span></li>' . "\n";
}
else
{
$categories = get_categories('include=7');
foreach ($categories as $cat) {
$ausgabe .= '<li class="cat-item cat-item-' . $categoryloop->cat_ID . '">' . $link . ' <span class="counter" >(' . $cat->category_count . ')</span></li>' . "\n";
}
}
$catposts = array();
}
} else {
$ausgabe .= '<li>' . __("Keine Einträge") . '</li>';
}
echo $ausgabe;
?>
</ul>
Alles anzeigen
Ps.: Welche Geschmacksrichtung Lollies bevorzugst du???
Liebe Grüße, Jana