pixeltocode
pixeltocode

Reputation: 5308

categories in Wordpress sidebar.php

the sidebar.php shows

<li>
 <?php wp_list_categories('show_count=1&title_li=<h2>Categories</h2>'); ?>
</li>

so which php file generates the Categories in the sidebar (wrapped in a tags and with number of posts)?

Upvotes: 0

Views: 3888

Answers (3)

Sean Fisher
Sean Fisher

Reputation: 625

Why edit the core when there are so many options to choose from! http://codex.wordpress.org/Template_Tags/wp_list_categories

Upvotes: 0

Pat
Pat

Reputation: 25675

If you're trying to change the output of this function, you can do it with a custom theme filter. Add the following to your theme's functions.php:

function custom_wp_list_categories($categories){
    // do something to the $categories returned by wp_list_categories()
    return $categories;
}
add_filter('wp_list_categories', 'custom_wp_list_categories');

The benefit of this approach is that it means that if you upgrade WordPress, you don't have to worry about making your changes again to the core files.

Upvotes: 3

clinton3141
clinton3141

Reputation: 4841

The function is located inside wp-includes/category-template.php

You can find out where any function is located by looking at the WordPress codex - at the bottom of each page, there is a link to where the function located.

Documentation for wp_list_categores

wp_list_categories function source code

Upvotes: 1

Related Questions