Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: single_cat_title

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
149      $year = (int) get_query_var('year');
150      $monthnum = (int) get_query_var('monthnum');
151      $day = (int) get_query_var('day');
152      $title = '';
153
154      // If there's a category
155      if ( !empty($cat) ) {
156                // category exclusion
157                if ( !stristr($cat,'-') )
158                     $title = apply_filters('single_cat_title', get_the_category_by_ID($cat));
159      } elseif ( !empty($category_name) ) {
160           if ( stristr($category_name,'/') ) {
161                     $category_name = explode('/',$category_name);
162                     if ( $category_name[count($category_name)-1] )
163                          $category_name = $category_name[count($category_name)-1]; // no trailing slash
164                     else
165                          $category_name = $category_name[count($category_name)-2]; // there was a trailling slash
166           }
167           $title = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE category_nicename = '$category_name'");
168           $title = apply_filters('single_cat_title', $title);
169      }
170
171      // If there's an author
172      if ( !empty($author) ) {
173           $title = get_userdata($author);
174           $title = $title->display_name;
175      }
176      if ( !empty($author_name) ) {
177           // We do a direct query here because we don't cache by nicename.