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
116
117      $result = apply_filters('get_nested_categories', $result);
118      usort( $result, 'sort_cats' );
119
120      return $result;
121 }
122
123 function write_nested_categories( $categories ) {
124      foreach ( $categories as $category ) {
125           echo '<li id="category-', $category['cat_ID'], '"><label for="in-category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="in-category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : "" ), '/> ', wp_specialchars( apply_filters('the_category', $category['cat_name'] )), "</label></li>";
126
127           if ( $category['children'] ) {
128                echo "<ul>\n";
129                write_nested_categories( $category['children'] );
130                echo "</ul>\n";
131           }
132      }
133 }
134
 
Line Code
151      }
152
153      $categories = get_terms('link_category', 'orderby=count&hide_empty=0');
154
155      if ( empty($categories) )
156           return;
157
158      foreach ( $categories as $category ) {
159           $cat_id = $category->term_id;
160           $name = wp_specialchars( apply_filters('the_category', $category->name));
161           $checked = in_array( $cat_id, $checked_categories );
162           echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', ($checked ? ' checked="checked"' : "" ), '/> ', $name, "</label></li>";
163      }
164 }
165
166 function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) {
167      global $wpdb, $class, $post;
168
169      if (!$pages )