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
86           $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
87
88           $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
89
90           /** This filter is documented in wp-includes/category-template.php */
91           $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" .
92                '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' .
93                checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) .
94                disabled( empty( $args['disabled'] ), false, false ) . ' /> ' .
95                esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>';
96      }
97
98      /**
99       * Ends the element output, if needed.
100       *
101       * @see Walker::end_el()
102       *
103       * @since 2.5.1
104       *
 
Line Code
275           $id = "popular-$taxonomy-$term->term_id";
276           $checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';
277           ?>
278
279           <li id="<?php echo $id; ?>" class="popular-category">
280                <label class="selectit">
281                     <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 ) ); ?> />
282                     <?php
283                     /** This filter is documented in wp-includes/category-template.php */
284                     echo esc_html( apply_filters( 'the_category', $term->name ) );
285                     ?>
286                </label>
287           </li>
288
289           <?php
290      }
291      return $popular_ids;
292 }
293
 
Line Code
313      $categories = get_terms( 'link_category', array( 'orderby' => 'name', 'hide_empty' => 0 ) );
314
315      if ( empty( $categories ) )
316           return;
317
318      foreach ( $categories as $category ) {
319           $cat_id = $category->term_id;
320
321           /** This filter is documented in wp-includes/category-template.php */
322           $name = esc_html( apply_filters( 'the_category', $category->name ) );
323           $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
324           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>";
325      }
326 }
327
328 // adds hidden fields with the data for use in the inline editor for posts and pages
329 /**
330  * {@internal Missing Short Description}}
331  *