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