[resolved] Display Total Post Count only on Child, but Hide on Parent (3 posts)

  1. Jauhari
    Posted 10 years ago #

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


  2. Jauhari
    Posted 10 years ago #

    Can anybody help me?

  3. Jauhari
    Posted 10 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic