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
208           $id = "popular-$taxonomy-$term->term_id";
209           $checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';
210           ?>
211
212           <li id="<?php echo $id; ?>" class="popular-category">
213                <label class="selectit">
214                     <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 ) ); ?> />
215                     <?php
216                     /** This filter is documented in wp-includes/category-template.php */
217                     echo esc_html( apply_filters( 'the_category', $term->name ) );
218                     ?>
219                </label>
220           </li>
221
222           <?php
223      }
224      return $popular_ids;
225 }
226
 
Line Code
249      $categories = get_terms( 'link_category', array( 'orderby' => 'name', 'hide_empty' => 0 ) );
250
251      if ( empty( $categories ) )
252           return;
253
254      foreach ( $categories as $category ) {
255           $cat_id = $category->term_id;
256
257           /** This filter is documented in wp-includes/category-template.php */
258           $name = esc_html( apply_filters( 'the_category', $category->name ) );
259           $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
260           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>";
261      }
262 }
263
264 /**
265  * Adds hidden fields with the data for use in the inline editor for posts and pages.
266  *
267  * @since 2.7.0