Fix teaser stripping when no teaser. Props makibo, simonwheatley. fixes #6312

git-svn-id: http://svn.automattic.com/wordpress/trunk@10954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-04-16 19:43:01 +00:00
parent 75bbf754bd
commit 989ddc7360
1 changed files with 4 additions and 1 deletions

View File

@ -183,6 +183,7 @@ function get_the_content($more_link_text = null, $stripteaser = 0, $more_file =
$more_link_text = __( '(more...)' ); $more_link_text = __( '(more...)' );
$output = ''; $output = '';
$hasTeaser = false;
// If post password required and it doesn't match the cookie. // If post password required and it doesn't match the cookie.
if ( post_password_required($post) ) { if ( post_password_required($post) ) {
@ -203,13 +204,15 @@ function get_the_content($more_link_text = null, $stripteaser = 0, $more_file =
$content = explode($matches[0], $content, 2); $content = explode($matches[0], $content, 2);
if ( !empty($matches[1]) && !empty($more_link_text) ) if ( !empty($matches[1]) && !empty($more_link_text) )
$more_link_text = strip_tags(wp_kses_no_null(trim($matches[1]))); $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
$hasTeaser = true;
} else { } else {
$content = array($content); $content = array($content);
} }
if ( (false !== strpos($post->post_content, '<!--noteaser-->') && ((!$multipage) || ($page==1))) ) if ( (false !== strpos($post->post_content, '<!--noteaser-->') && ((!$multipage) || ($page==1))) )
$stripteaser = 1; $stripteaser = 1;
$teaser = $content[0]; $teaser = $content[0];
if ( ($more) && ($stripteaser) ) if ( ($more) && ($stripteaser) && ($hasTeaser) )
$teaser = ''; $teaser = '';
$output .= $teaser; $output .= $teaser;
if ( count($content) > 1 ) { if ( count($content) > 1 ) {