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
76
77           if ( $taxonomy == 'category' )
78                $name = 'post_category';
79           else
80                $name = 'tax_input['.$taxonomy.']';
81
82           $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
83
84           /** This filter is documented in wp-includes/category-template.php */
85           $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>';
86      }
87
88      /**
89       * Ends the element output, if needed.
90       *
91       * @see Walker::end_el()
92       *
93       * @since 2.5.1
94       *
 
Line Code
245           $id = "popular-$taxonomy-$term->term_id";
246           $checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';
247           ?>
248
249           <li id="<?php echo $id; ?>" class="popular-category">
250                <label class="selectit">
251                     <input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" <?php disabled( ! current_user_can( $tax->cap->assign_terms ) ); ?> />
252                     <?php
253                     /** This filter is documented in wp-includes/category-template.php */
254                     echo esc_html( apply_filters( 'the_category', $term->name ) );
255                     ?>
256                </label>
257           </li>
258
259           <?php
260      }
261      return $popular_ids;
262 }
263
 
Line Code
283      $categories = get_terms( 'link_category', array( 'orderby' => 'name', 'hide_empty' => 0 ) );
284
285      if ( empty( $categories ) )
286           return;
287
288      foreach ( $categories as $category ) {
289           $cat_id = $category->term_id;
290
291           /** This filter is documented in wp-includes/category-template.php */
292           $name = esc_html( apply_filters( 'the_category', $category->name ) );
293           $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
294           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>";
295      }
296 }
297
298 // adds hidden fields with the data for use in the inline editor for posts and pages
299 /**
300  * {@internal Missing Short Description}}
301  *