• I want to add ‘entry / entries’ after each category count. Here’s what I’ve got up until now:

    $catID = get_cat_id('Projects');
    $variable = wp_list_categories('title_li=&echo=0&show_count=1&exclude=' . $catID);
    $variable = str_replace( '(', '', $variable);
    $variable = str_replace( ')', ' entries', $variable);
    echo $variable;

    How can I make the code detect categories with 1 entry and echo “entry” instead of “entries”?

Viewing 2 replies - 1 through 2 (of 2 total)
  • How about:

    $catID = get_cat_id('Projects');
    $test = get_categories('exclude=' . $catID);
    if(count($test) >= 2) $extra = 'entries';
    else $extra = 'entry';
    $variable = wp_list_categories('title_li=&echo=0&show_count=1&exclude=' . $catID);
    $variable = str_replace( '(', '', $variable);
    $variable = str_replace( ')', $extra, $variable);
    echo $variable;
    Thread Starter norbiu

    (@norbiu)

    Doesn’t seem to work. The count is always showing 3.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Entry / Entries After Category Count’ is closed to new replies.