Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: the_category

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
37           $catlink = str_replace('%category%', $category_nicename, $catlink);
38           $catlink = get_settings('home') . trailingslashit($catlink);
39      }
40      return apply_filters('category_link', $catlink, $category_id);
41 }
42
43 function get_the_category_list($separator = '', $parents='') {
44      $categories = get_the_category();
45      if (empty($categories))
46           return apply_filters('the_category', __('Uncategorized'), $separator, $parents);
47
48      $thelist = '';
49      if ( '' == $separator ) {
50           $thelist .= '<ul class="post-categories">';
51           foreach ( $categories as $category ) {
52                $category->cat_name = $category->cat_name;
53                $thelist .= "\n\t<li>";
54                switch ( strtolower($parents) ) {
55                     case 'multiple':
 
Line Code
88                          $thelist .= "$category->cat_name</a>";
89                          break;
90                     case '':
91                     default:
92                          $thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a>';
93                }
94                ++$i;
95           }
96      }
97      return apply_filters('the_category', $thelist, $separator, $parents);
98 }
99
100 function the_category($separator = '', $parents='') {
101      echo get_the_category_list($separator, $parents);
102 }
103
104 function get_the_category_by_ID($cat_ID) {
105      $cat_ID = (int) $cat_ID;
106      $category = &get_category($cat_ID);