Changeset 2341 for trunk/wp-includes/template-functions-post.php
- Timestamp:
- 02/15/2005 12:21:21 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-post.php
r2330 r2341 105 105 106 106 function the_excerpt() { 107 107 echo apply_filters('the_excerpt', get_the_excerpt()); 108 108 } 109 109 110 110 function get_the_excerpt($fakeit = true) { 111 global $id, $post; 112 $output = ''; 113 $output = $post->post_excerpt; 114 if (!empty($post->post_password)) { // if there's a password 115 if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie 116 $output = __('There is no excerpt because this is a protected post.'); 117 return $output; 118 } 119 } 120 121 // If we haven't got an excerpt, make one in the style of the rss ones 122 if (($output == '') && $fakeit) { 123 $output = $post->post_content; 124 $output = strip_tags($output); 125 $blah = explode(' ', $output); 126 $excerpt_length = 70; 127 if (count($blah) > $excerpt_length) { 128 $k = $excerpt_length; 129 $use_dotdotdot = 1; 130 } else { 131 $k = count($blah); 132 $use_dotdotdot = 0; 133 } 134 $excerpt = ''; 135 for ($i=0; $i<$k; $i++) { 136 $excerpt .= $blah[$i].' '; 137 } 138 $excerpt .= ($use_dotdotdot) ? '...' : ''; 139 $output = $excerpt; 140 } // end if no excerpt 141 return $output; 111 global $id, $post; 112 $output = ''; 113 $output = $post->post_excerpt; 114 if (!empty($post->post_password)) { // if there's a password 115 if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie 116 $output = __('There is no excerpt because this is a protected post.'); 117 return $output; 118 } 119 } 120 121 return apply_filters('get_the_excerpt', $output); 142 122 } 143 123
Note: See TracChangeset
for help on using the changeset viewer.