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 3 times in this file.

Line Code
373      $class = esc_attr( $class );
374      $id = $id ? esc_attr( $id ) : $name;
375
376      if ( ! $r['hide_if_empty'] || ! empty($categories) )
377           $output = "<select name='$name' id='$id' class='$class' $tab_index_attribute>\n";
378      else
379           $output = '';
380
381      if ( empty($categories) && ! $r['hide_if_empty'] && !empty($show_option_none) ) {
382           $show_option_none = apply_filters( 'list_cats', $show_option_none );
383           $output .= "\t<option value='-1' selected='selected'>$show_option_none</option>\n";
384      }
385
386      if ( ! empty( $categories ) ) {
387
388           if ( $show_option_all ) {
389                $show_option_all = apply_filters( 'list_cats', $show_option_all );
390                $selected = ( '0' === strval($r['selected']) ) ? " selected='selected'" : '';
391                $output .= "\t<option value='0'$selected>$show_option_all</option>\n";
392           }
393
394           if ( $show_option_none ) {
395                $show_option_none = apply_filters( 'list_cats', $show_option_none );
396                $selected = ( '-1' === strval($r['selected']) ) ? " selected='selected'" : '';
397                $output .= "\t<option value='-1'$selected>$show_option_none</option>\n";
398           }
399
400           if ( $hierarchical )
401                $depth = $r['depth'];  // Walk the full depth.
402           else
403                $depth = -1; // Flat.
404