WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Display Total Post Count only on Child, but Hide on Parent

[Resolved] Display Total Post Count only on Child, but Hide on Parent

  • How to make this.
    I want on Parent Category hide the total count, but on child category the total post count will show.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Can anybody help me?

    I have find how to do this. and this what I’m doing.

    I find on wp-includes/template-functions-category.php
    then find this function wp_list_cats and list_cats then I make copy to my own function on my themes directory.

    Then I make some change that function to the new one.
    example wp_list_cats & xlist_cats

    Then I add this code on if statement in this line.

    if ( intval($optioncount) == 1 )
    $link .= ‘ (‘.intval($category->category_count).’)’;

    with this

    if ( intval($optioncount) == 1 & $category->category_parent!=0 )
    $link .= ‘ < span>(‘.intval($category->category_count).’)< /span>‘;

    Why I’m add some < span> code? It’s for better CSS styling 🙂

    Thanks for my friends arief fajar nursyamsu

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Display Total Post Count only on Child, but Hide on Parent’ is closed to new replies.