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       // Determines position of the separator
241      if ( 'right' == $seplocation )
242           $title = $title . $prefix;
 
Line Code
258      global $wpdb;
259      $p = get_query_var('p');
260      $name = get_query_var('name');
261
262      if ( intval($p) || '' != $name ) {
263           if ( !$p )
264                $p = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s", $name));
265           $post = & get_post($p);
266           $title = $post->post_title;
267           $title = apply_filters('single_post_title', $title);
268           if ( $display )
269                echo $prefix.strip_tags($title);
270           else
271                return strip_tags($title);
272      }
273 }
274
275
276 function single_cat_title($prefix = '', $display = true ) {