WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )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.
This hook occurs 3 times in this file.
| Line | Code |
|---|---|
| 173 | $year = get_query_var('year'); |
| 174 | $monthnum = get_query_var('monthnum'); |
| 175 | $day = get_query_var('day'); |
| 176 | $title = ''; |
| 177 | |
| 178 | // If there's a category |
| 179 | if ( !empty($cat) ) { |
| 180 | // category exclusion |
| 181 | if ( !stristr($cat,'-') ) |
| 182 | $title = apply_filters('single_cat_title', get_the_category_by_ID($cat)); |
| 183 | } elseif ( !empty($category_name) ) { |
| 184 | if ( stristr($category_name,'/') ) { |
| 185 | $category_name = explode('/',$category_name); |
| 186 | if ( $category_name[count($category_name)-1] ) |
| 187 | $category_name = $category_name[count($category_name)-1]; // no trailing slash |
| 188 | else |
| 189 | $category_name = $category_name[count($category_name)-2]; // there was a trailling slash |
| 190 | } |
| 191 | $cat = get_term_by('slug', $category_name, 'category', OBJECT, 'display'); |
| 192 | if ( $cat ) |
| 193 | $title = apply_filters('single_cat_title', $cat->name); |
| 194 | } |
| 195 | |
| 196 | if ( !empty($tag) ) { |
| 197 | $tag = get_term($tag, 'post_tag', OBJECT, 'display'); |
| 198 | if ( is_wp_error( $tag ) ) |
| 199 | return $tag; |
| 200 | if ( ! empty($tag->name) ) |
| 201 | $title = apply_filters('single_tag_title', $tag->name); |
| 202 | } |
| Line | Code |
| 270 | else |
| 271 | return strip_tags($title); |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | |
| 276 | function single_cat_title($prefix = '', $display = true ) { |
| 277 | $cat = intval( get_query_var('cat') ); |
| 278 | if ( !empty($cat) && !(strtoupper($cat) == 'ALL') ) { |
| 279 | $my_cat_name = apply_filters('single_cat_title', get_the_category_by_ID($cat)); |
| 280 | if ( !empty($my_cat_name) ) { |
| 281 | if ( $display ) |
| 282 | echo $prefix.strip_tags($my_cat_name); |
| 283 | else |
| 284 | return strip_tags($my_cat_name); |
| 285 | } |
| 286 | } else if ( is_tag() ) { |
| 287 | return single_tag_title($prefix, $display); |
| 288 | } |