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 3 times in this file.

Line Code
37           if ( empty($taxonomy) )
38                $taxonomy = 'category';
39
40           if ( $taxonomy == 'category' )
41                $name = 'post_category';
42           else
43                $name = 'tax_input['.$taxonomy.']';
44
45           $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
46           $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . checked( in_array( $category->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
47      }
48
49      function end_el(&$output, $category, $depth, $args) {
50           $output .= "</li>\n";
51      }
52 }
53
54 /**
55  * {@internal Missing Short Description}}
 
Line Code
174           if ( !$echo ) // hack for AJAX use
175                continue;
176           $id = "popular-$taxonomy-$term->term_id";
177           $checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';
178           ?>
179
180           <li id="<?php echo $id; ?>" class="popular-category">
181                <label class="selectit">
182                <input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" <?php echo $disabled ?>/>
183                     <?php echo esc_html( apply_filters( 'the_category', $term->name ) ); ?>
184                </label>
185           </li>
186
187           <?php
188      }
189      return $popular_ids;
190 }
191
192 /**
 
Line Code
209      }
210
211      $categories = get_terms( 'link_category', array( 'orderby' => 'name', 'hide_empty' => 0 ) );
212
213      if ( empty( $categories ) )
214           return;
215
216      foreach ( $categories as $category ) {
217           $cat_id = $category->term_id;
218           $name = esc_html( apply_filters( 'the_category', $category->name ) );
219           $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
220           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, '/> ', $name, "</label></li>";
221      }
222 }
223
224 // adds hidden fields with the data for use in the inline editor for posts and pages
225 /**
226  * {@internal Missing Short Description}}
227  *