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 |
|---|---|
| 377 | $day = get_query_var('day'); |
| 378 | $title = ''; |
| 379 | |
| 380 | $t_sep = '%WP_TITILE_SEP%'; // Temporary separator, for accurate flipping, if necessary |
| 381 | |
| 382 | // If there's a category |
| 383 | if ( !empty($cat) ) { |
| 384 | // category exclusion |
| 385 | if ( !stristr($cat,'-') ) |
| 386 | $title = apply_filters('single_cat_title', get_the_category_by_ID($cat)); |
| 387 | } elseif ( !empty($category_name) ) { |
| 388 | if ( stristr($category_name,'/') ) { |
| 389 | $category_name = explode('/',$category_name); |
| 390 | if ( $category_name[count($category_name)-1] ) |
| 391 | $category_name = $category_name[count($category_name)-1]; // no trailing slash |
| 392 | else |
| 393 | $category_name = $category_name[count($category_name)-2]; // there was a trailling slash |
| 394 | } |
| 395 | $cat = get_term_by('slug', $category_name, 'category', OBJECT, 'display'); |
| 396 | if ( $cat ) |
| 397 | $title = apply_filters('single_cat_title', $cat->name); |
| 398 | } |
| 399 | |
| 400 | if ( !empty($tag) ) { |
| 401 | $tag = get_term($tag, 'post_tag', OBJECT, 'display'); |
| 402 | if ( is_wp_error( $tag ) ) |
| 403 | return $tag; |
| 404 | if ( ! empty($tag->name) ) |
| 405 | $title = apply_filters('single_tag_title', $tag->name); |
| 406 | } |
| Line | Code |
| 525 | * @since 0.71 |
| 526 | * |
| 527 | * @param string $prefix Optional. What to display before the title. |
| 528 | * @param bool $display Optional, default is true. Whether to display or retrieve title. |
| 529 | * @return string|null Title when retrieving, null when displaying or failure. |
| 530 | */ |
| 531 | function single_cat_title($prefix = '', $display = true ) { |
| 532 | $cat = intval( get_query_var('cat') ); |
| 533 | if ( !empty($cat) && !(strtoupper($cat) == 'ALL') ) { |
| 534 | $my_cat_name = apply_filters('single_cat_title', get_the_category_by_ID($cat)); |
| 535 | if ( !empty($my_cat_name) ) { |
| 536 | if ( $display ) |
| 537 | echo $prefix.strip_tags($my_cat_name); |
| 538 | else |
| 539 | return strip_tags($my_cat_name); |
| 540 | } |
| 541 | } else if ( is_tag() ) { |
| 542 | return single_tag_title($prefix, $display); |
| 543 | } |