Changeset 2341 for trunk/wp-includes/functions-formatting.php
- Timestamp:
- 02/15/2005 12:21:21 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions-formatting.php
r2246 r2341 643 643 } 644 644 645 function wp_trim_excerpt( $text ) { // Fakes an excerpt if needed 646 global $post; 647 if ( '' == $text ) { 648 $text = $post->post_content; 649 $text = strip_tags( $text ); 650 $blah = explode(' ', $text); 651 $excerpt_length = 55; 652 if (count($blah) > $excerpt_length) { 653 $k = $excerpt_length; 654 $use_dotdotdot = 1; 655 } else { 656 $k = count($blah); 657 $use_dotdotdot = 0; 658 } 659 $excerpt = ''; 660 for ($i=0; $i<$k; $i++) { 661 $excerpt .= $blah[$i].' '; 662 } 663 $excerpt .= ($use_dotdotdot) ? '[...]' : ''; 664 $text = $excerpt; 665 } // end if no excerpt 666 return $text; 667 } 668 645 669 ?>
Note: See TracChangeset
for help on using the changeset viewer.