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)?
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.
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
Why edit the core when there are so many options to choose from! http://codex.wordpress.org/Template_Tags/wp_list_categories
精彩评论