Welcome, visitor! Log in
 

Source View: the_excerpt

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.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: 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.

Source View

Line Code
1321   */
1322  function do_trackbacks($post_id) {
1323       global $wpdb;
1324  
1325       $post = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id) );
1326       $to_ping = get_to_ping($post_id);
1327       $pinged  = get_pung($post_id);
1328       if ( empty($to_ping) ) {
1329            $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET to_ping = '' WHERE ID = %d", $post_id) );
1330            return;
1331       }
1332  
1333       if ( empty($post->post_excerpt) )
1334            $excerpt = apply_filters('the_content', $post->post_content);
1335       else
1336            $excerpt = apply_filters('the_excerpt', $post->post_excerpt);
1337       $excerpt = str_replace(']]>', ']]>', $excerpt);
1338       $excerpt = wp_html_excerpt($excerpt, 252) . '...';
1339  
1340       $post_title = apply_filters('the_title', $post->post_title);
1341       $post_title = strip_tags($post_title);
1342  
1343       if ( $to_ping ) {
1344            foreach ( (array) $to_ping as $tb_ping ) {
1345                 $tb_ping = trim($tb_ping);
1346                 if ( !in_array($tb_ping, $pinged) ) {
1347                      trackback($tb_ping, $post_title, $excerpt, $post_id);
1348                      $pinged[] = $tb_ping;
1349                 } else {
1350                      $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_ping', '')) WHERE ID = %d", $post_id) );
1351                 }