Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: single_post_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
579           if ( !empty($monthnum) )
580                $title .= $t_sep . $wp_locale->get_month($monthnum);
581           if ( !empty($day) )
582                $title .= $t_sep . zeroise($day, 2);
583      }
584
585      // If there is a post
586      if ( is_single() || ( is_home() && !is_front_page() ) || ( is_page() && !is_front_page() ) ) {
587           $post = $wp_query->get_queried_object();
588           $title = apply_filters( 'single_post_title', $post->post_title );
589      }
590
591      // If there's a taxonomy
592      if ( is_tax() ) {
593           $taxonomy = get_query_var( 'taxonomy' );
594           $tax = get_taxonomy( $taxonomy );
595           $term = $wp_query->get_queried_object();
596           $term = $term->name;
597           $title = $tax->labels->name . $t_sep . $term;
 
Line Code
654
655      if ( ! $post )
656           $_post = $wp_query->get_queried_object();
657      else
658           $_post = $post;
659
660      if ( !isset($_post->post_title) )
661           return;
662
663      $title = apply_filters('single_post_title', $_post->post_title, $_post);
664      if ( $display )
665           echo $prefix . $title;
666      else
667           return $title;
668 }
669
670 /**
671  * Display or retrieve page title for category archive.
672  *