Added return excerpt if none

git-svn-id: http://svn.automattic.com/wordpress/trunk@17 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
mikelittle 2003-05-06 22:15:28 +00:00
parent 1389939619
commit 0907d4faf1
1 changed files with 22 additions and 3 deletions

View File

@ -413,6 +413,7 @@ function the_excerpt_rss($cut = 0, $encode_html = 0) {
}
echo $excerpt;
}
function the_excerpt_unicode() {
$excerpt = get_the_excerpt();
$excerpt = convert_bbcode($excerpt);
@ -422,20 +423,38 @@ function the_excerpt_unicode() {
$excerpt = apply_filters('the_excerpt_unicode', $excerpt);
echo $excerpt;
}
function get_the_excerpt() {
global $id,$postdata;
global $HTTP_SERVER_VARS, $preview;
$output = '';
$output = $postdata['Excerpt'];
//if we haven't got an excerpt, make one in the style of the rss ones
if ($output == '') {
$output = get_the_content();
$output = strip_tags($output);
$blah = explode(' ', $output);
$excerpt_length = 120;
if (count($blah) > $excerpt_length) {
$k = $excerpt_length;
$use_dotdotdot = 1;
} else {
$k = count($blah);
$use_dotdotdot = 0;
}
for ($i=0; $i<$k; $i++) {
$excerpt .= $blah[$i].' ';
}
$excerpt .= ($use_dotdotdot) ? '...' : '';
$output = $excerpt;
} // end if no excerpt
if ($preview) { // preview fix for javascript bug with foreign languages
$output = preg_replace('/\%u([0-9A-F]{4,4})/e', "'&#'.base_convert('\\1',16,10).';'", $output);
}
return($output);
return $output;
}
function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='') {
global $id,$page,$numpages,$multipage,$more;
global $pagenow;