Welcome, visitor! Log in
 

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.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
692            foreach ( $cats as $cat) {
693                 $result[$cat]['children'] = get_nested_categories( $default, $cat);
694                 $result[$cat]['cat_ID'] = $cat;
695                 $result[$cat]['checked'] = in_array( $cat, $checked_categories );
696                 $result[$cat]['cat_name'] = get_the_category_by_ID( $cat);
697            }
698       }
699  
700       usort( $result, 'sort_cats' );
701  
702       return $result;
703  }
704  
705  function write_nested_categories( $categories ) {
706       foreach ( $categories as $category ) {
707            echo '<li id="category-', $category['cat_ID'], '"><label for="in-category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="in-category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : "" ), '/> ', wp_specialchars( apply_filters('the_category', $category['cat_name'] )), "</label></li>";
708  
709            if ( $category['children'] ) {
710                 echo "<ul>\n";
711                 write_nested_categories( $category['children'] );
712                 echo "</ul>\n";
713            }
714       }
715  }
716  
717  function dropdown_categories( $default = 0 ) {
718       write_nested_categories( get_nested_categories( $default) );
719  }
720  
721  function return_link_categories_list( $parent = 0 ) {
722       global $wpdb;