#113 closed defect (bug) (fixed)
Post content 'lost' if multiple <!--more--> (more...) tags used.
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | |
Component: | Template | Keywords: | |
Focuses: | Cc: |
Description
In file /wp-includes/template-functions-post.php line 117:
$content = explode('<!--more-->', $content);
explode() splits $content into number of '<!--more-->' + 1 parts. Only $content[0] and $content[1] is used. If, for any reason, more '<!--more--> tags get in the post, content after the secont is not displayed.
Attachments (1)
Change History (8)
#3
@
21 years ago
<!--more--> is suppose to be used only once (as far as I know and makes sense to me). For more pages, you should use <!--nextpage-->.
#4
@
21 years ago
Yes, I agree with that. My thought was in the direction of userfriendly-ness. In case any user by any reason, or without reason, adds an extra <!--more--> somewhere - any content after the second <!--more--> won't show.
Um. My reasoning is that if <!--more--> is not to be used more than once, $content shouldn't be split into more than two parts, or all subsequent parts of $content needs to be set back together.
#5
@
21 years ago
Simple fix for this:
in wp-includes/template-functions-post.php, function get_the_content().
Change this:
$content = explode('<!--more-->', $content);
to:
$content = explode('<!--more-->', $content, 2);
I've attached a diff. Also discussed the change <a href="http://www.coffee2code.com/archives/2004/08/03/patch-dealing-with-multiple-more/">here</a>.
Fix should be:
$allcontent = "";
for ($counter = 1; $counter < count($content); $counter++) {
}
if ($more) {
Three errors.
Counting beyond array with <=
Adding to wrong variable $count
Only using last content ($allcontent = $content[$counter];)
Sorry. Tired.