Support » Themes and Templates » Where do i find this code?

  • Hi there,

    I have just started using wordpress. I use the rainbow-style theme. I would like it to show the number of posts in each category. I learned that i should use this code:


    I am not a programmer and couldn’t find out in which file this code is. I searched for the string with windows search function but i didn’t return anything.

    I hope that someone here could tell me in which file this code is located. Is it in a theme file or in a wordpress file. Is it already there and should i just change it to above or should it be added somewhere?


Viewing 2 replies - 1 through 2 (of 2 total)
  • The code is in your theme’s directory. I’m not familiar with the theme and you didn’t share a link… but for many themes, the category list is in the sidebar.php file.

    If your theme already lists category, it’s probably already using the wp_list_cats function and you’d just need to add: &optioncount=1 to it.

    Thanks but &optioncount=1 is already enabled. It uses wp_list_cats in sidebar.php:

    <?php wp_list_cats(‘sort_column=name&optioncount=1&hierarchical=0&list=0’); ?>

    In the default theme this function is used in sidebar.php:
    <?php wp_list_categories(‘show_count=1&title_li=<h2>Categories</h2>’); ?>

    With this categories is shown correctly:
    Abort (2)
    – child1
    – child2

    etc. But using wp_list_categories in sidebar.php of the rainbow_style theme doesn’t work as it should. It shows them this way:
    (2) – number of posts on a new line

    and the subcategories

    isn’t shown. I understand that wp_list_cats is a deprecated function. Do you know what to add to the wp_list_categories function to make the categories appear like this:

    Abort (2)
    – subcategory1
    – subcategory2


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Where do i find this code?’ is closed to new replies.