mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Show more link in RSS. Don't show more link if more link text empty. Take more into account when creating excerpt.
git-svn-id: http://svn.automattic.com/wordpress/trunk@4184 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0eeccc10e9
commit
f666759471
@ -741,7 +741,7 @@ function human_time_diff( $from, $to = '' ) {
|
||||
function wp_trim_excerpt($text) { // Fakes an excerpt if needed
|
||||
global $post;
|
||||
if ( '' == $text ) {
|
||||
$text = $post->post_content;
|
||||
$text = get_the_content('');
|
||||
$text = apply_filters('the_content', $text);
|
||||
$text = str_replace(']]>', ']]>', $text);
|
||||
$text = strip_tags($text);
|
||||
|
@ -82,7 +82,7 @@ function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_
|
||||
$content = $pages[$page-1];
|
||||
if ( preg_match('/<!--more(.+?)?-->/', $content, $matches) ) {
|
||||
$content = explode($matches[0], $content, 2);
|
||||
if ( !empty($matches[1]) )
|
||||
if ( !empty($matches[1]) && !empty($more_link_text) )
|
||||
$more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
|
||||
} else {
|
||||
$content = array($content);
|
||||
@ -94,10 +94,14 @@ function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_
|
||||
$teaser = '';
|
||||
$output .= $teaser;
|
||||
if ( count($content) > 1 ) {
|
||||
if ( $more )
|
||||
if ( $more ) {
|
||||
$output .= '<a id="more-'.$id.'"></a>'.$content[1];
|
||||
else
|
||||
$output = balanceTags($output . ' <a href="'. get_permalink() . "#more-$id\">$more_link_text</a>");
|
||||
} else {
|
||||
$output = balanceTags($output);
|
||||
if ( ! empty($more_link_text) )
|
||||
$output .= ' <a href="'. get_permalink() . "#more-$id\">$more_link_text</a>";
|
||||
}
|
||||
|
||||
}
|
||||
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);
|
||||
|
@ -42,7 +42,7 @@ $more = 1;
|
||||
<?php else : ?>
|
||||
<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
|
||||
<?php if ( strlen( $post->post_content ) > 0 ) : ?>
|
||||
<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
|
||||
<content:encoded><![CDATA[<?php the_content() ?>]]></content:encoded>
|
||||
<?php else : ?>
|
||||
<content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>
|
||||
<?php endif; ?>
|
||||
|
Loading…
Reference in New Issue
Block a user