Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: list_cats

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
579           $indent = str_repeat("\t", $depth);
580           $output .= "$indent</ul>\n";
581           return $output;
582      }
583
584      function start_el($output, $category, $depth, $args) {
585           extract($args);
586
587           $cat_name = attribute_escape( $category->name);
588           $cat_name = apply_filters( 'list_cats', $cat_name, $category );
589           $link = '<a href="' . get_category_link( $category->term_id ) . '" ';
590           if ( $use_desc_for_title == 0 || empty($category->description) )
591                $link .= 'title="' . sprintf(__( 'View all posts filed under %s' ), $cat_name) . '"';
592           else
593                $link .= 'title="' . attribute_escape( apply_filters( 'category_description', $category->description, $category )) . '"';
594           $link .= '>';
595           $link .= $cat_name . '</a>';
596
597           if ( (! empty($feed_image)) || (! empty($feed)) ) {
 
Line Code
659 }
660
661 class Walker_CategoryDropdown extends Walker {
662      var $tree_type = 'category';
663      var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
664
665      function start_el($output, $category, $depth, $args) {
666           $pad = str_repeat('&nbsp;', $depth * 3);
667
668           $cat_name = apply_filters('list_cats', $category->name, $category);
669           $output .= "\t<option value=\"".$category->term_id."\"";
670           if ( $category->term_id == $args['selected'] )
671                $output .= ' selected="selected"';
672           $output .= '>';
673           $output .= $pad.$cat_name;
674           if ( $args['show_count'] )
675                $output .= '&nbsp;&nbsp;('. $category->count .')';
676           if ( $args['show_last_update'] ) {
677                $format = 'Y-m-d';