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
224           if ( !empty($monthnum) )
225                $title .= " $sep " . $wp_locale->get_month($monthnum);
226           if ( !empty($day) )
227                $title .= " $sep " . zeroise($day, 2);
228      }
229
230      // If there is a post
231      if ( is_single() || is_page() ) {
232           $post = $wp_query->get_queried_object();
233           $title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) );
234      }
235
236      $prefix = '';
237      if ( !empty($title) )
238           $prefix = " $sep ";
239
240      $title = $prefix . $title;
241      $title = apply_filters('wp_title', $title, $sep);
242
 
Line Code
252      global $wpdb;
253      $p = get_query_var('p');
254      $name = get_query_var('name');
255
256      if ( intval($p) || '' != $name ) {
257           if ( !$p )
258                $p = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$name'");
259           $post = & get_post($p);
260           $title = $post->post_title;
261           $title = apply_filters('single_post_title', $title);
262           if ( $display )
263                echo $prefix.strip_tags($title);
264           else
265                return strip_tags($title);
266      }
267 }
268
269
270 function single_cat_title($prefix = '', $display = true ) {