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
234           $id      = "popular-$taxonomy-$term->term_id";
235           $checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';
236           ?>
237
238           <li id="<?php echo $id; ?>" class="popular-category">
239                <label class="selectit">
240                     <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 ) ); ?> />
241                     <?php
242                     /** This filter is documented in wp-includes/category-template.php */
243                     echo esc_html( apply_filters( 'the_category', $term->name, '', '' ) );
244                     ?>
245                </label>
246           </li>
247
248           <?php
249      }
250      return $popular_ids;
251 }
252
 
Line Code
282
283      if ( empty( $categories ) ) {
284           return;
285      }
286
287      foreach ( $categories as $category ) {
288           $cat_id = $category->term_id;
289
290           /** This filter is documented in wp-includes/category-template.php */
291           $name    = esc_html( apply_filters( 'the_category', $category->name, '', '' ) );
292           $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
293           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>';
294      }
295 }
296
297 /**
298  * Adds hidden fields with the data for use in the inline editor for posts and pages.
299  *
300  * @since 2.7.0