Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#13361 closed defect (bug) (fixed)

In Twenty Ten, custom excerpts do not show "Continue reading"

Reported by: pbearne's profile pbearne Owned by: iandstewart's profile iandstewart
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: Themes Keywords: commit
Focuses: Cc:

Description (last modified by nacin)

The excerpt_more text is only used when an excerpt needs to be cut down in length in wp_trim_excerpt. A custom excerpt will not get a "Continue reading" link in Twenty Ten.

Attachments (5)

fancy_excerpts.diff (1.4 KB) - added by iandstewart 15 years ago.
Filter the traditional "[…]" in excerpts with an empty string and adds a fancy "Continue reading link" to both trimmed excerpts AND custom excerpts.
fancier_excerpts.diff (1.8 KB) - added by iandstewart 15 years ago.
Filter excerpt_more and--if there's a custom excerpt--filter get_the_excerpt to add a pretty "Continue reading" link to trimmed excerpts AND custom excerpts but NOT posts less than the excerpt length.
cautiously_fancy_excerpts.diff (1.8 KB) - added by iandstewart 15 years ago.
Generate a "Continue Reading" link, filter excerpt_more and--if there's a custom excerpt--filter get_the_excerpt to add our generated link to trimmed excerpts AND custom excerpts but NOT posts less than the excerpt length.
13361-hakre_-_csp_-_content-security-policy_-_plugin_settings-08-activate - trunk_1275402863563.png (70.3 KB) - added by hakre 15 years ago.
Current trunk attachment page / continue reading ->
excerpt-attachment-check.diff (442 bytes) - added by iandstewart 15 years ago.
Don't add continue reading link to attachment templates

Download all attachments as: .zip

Change History (28)

#1 @nacin
15 years ago

  • Component changed from Template to Themes
  • Description modified (diff)
  • Owner set to iammattthomas
  • Status changed from new to assigned
  • Summary changed from the_excerpt() not return Continuation text when return excerpt for a post to In Twenty Ten, custom excerpts do not show "Continue reading"

Editing the title and description, and assigning to Matt Thomas.

This was brought up on one of the mailing lists a month ago as well. More or less, as the new description indicates, the excerpt_more text isn't used when we're handling custom excerpts. That might have been an oversight in 2.9, but that's too late to address in 3.0.

That said, perhaps Twenty Ten should filter excerpt_more to an empty string, then always append 'Continue Reading' on our own.

Also, there's some bad code there. the_excerpt does not take any parameters. No matter how hard you try, it won't echo out a link the way the_content does.

#2 follow-up: @pbearne
15 years ago

that code came from the 2010 theme

I feel that this needs to the_excerpt should work the same as the_content

#3 in reply to: ↑ 2 ; follow-up: @nacin
15 years ago

Replying to pbearne:

that code came from the 2010 theme

I know. And it's wrong.

I feel that this needs to the_excerpt should work the same as the_content

That's not going to happen for 3.0, if ever (the_excerpt's first argument is deprecated, so we can't use it).

#4 in reply to: ↑ 3 @pbearne
15 years ago

Replying to nacin:

Replying to pbearne:

that code came from the 2010 theme

I know. And it's wrong.

I feel that this needs to the_excerpt should work the same as the_content

That's not going to happen for 3.0, if ever (the_excerpt's first argument is deprecated, so we can't use it).

thanks for the reply I guess it better be done as a function call

#5 @pbearne
15 years ago

add this to the function.php and we get the more link added to extracts

function twentyten_excerpt( $more ) {
//	return $more.' &hellip; <a href="'. get_permalink() . '">' . __('Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten') . '</a>';
	
}
add_filter( 'the_excerpt', 'twentyten_excerpt' ); 

#6 @pbearne
15 years ago

this is also broken in the RSS feeds

the_excerpt's first argument is deprecated in 2.3 its likly that is safe to reuse this. I would like to suggeest that do that so that it behave the same way as the get_post

#7 @iandstewart
15 years ago

If the excerpt_more filter is only intended to filter the '[…]' of trimmed content I'm inclined to roll with the default behavior rather than have Twenty Ten get any more complicated.

#8 @nacin
15 years ago

Correct, that's all excerpt_more is intended to do.

It's been pointed out on wp-testers or hackers that this is inconsistent, and I agree. We should either pull it, or enhance it. I think I'm for enhancing it for consistency, otherwise you get that goofy [...] we all love to hate.

We might even be able to do it with one function attached to both hooks.

#9 @iammattthomas
15 years ago

  • Owner changed from iammattthomas to iandstewart

Talked to Ian and he's going to own this one, as he knows a lot more about Twenty Ten's functions than I do.

@iandstewart
15 years ago

Filter the traditional "[…]" in excerpts with an empty string and adds a fancy "Continue reading link" to both trimmed excerpts AND custom excerpts.

@iandstewart
15 years ago

Filter excerpt_more and--if there's a custom excerpt--filter get_the_excerpt to add a pretty "Continue reading" link to trimmed excerpts AND custom excerpts but NOT posts less than the excerpt length.

#10 @iandstewart
15 years ago

  • Keywords needs-testing added

#11 @nacin
15 years ago

Reviewing this. Looks good. Think it would be cool to do both with one function, but that would require a current_filter call it seems to prevent two "Continue reading" links.

Actually, after a pretty excerpt you'd still get '...' before you then get "Continue reading." Maybe we force "" through excerpt_more, then check for false == has_excerpt in order to decide whether to add '...'? Then we're also not using the string in two locations.

Going to play with this.

#12 @nacin
15 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [14889]) Always show 'Continue reading' link when dealing with excerpts in Twenty Ten. props iandstewart, fixes #13361.

#13 @nacin
15 years ago

Okay. Tested with a custom excerpt and auto-generated excerpts (both truncated and untruncated). You always get 'Continue reading...' and if it was a truncated auto-generated excerpt, you also get an ellipsis.

Thanks Ian!

#14 @nacin
15 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

After IRC discussion with Ian a few days ago and now #13588, I want to ponder this some more.

#15 @iandstewart
15 years ago

@nacin — Your commit caught that custom excerpts wouldn't need an ellipsis. Good catch.

@iandstewart
15 years ago

Generate a "Continue Reading" link, filter excerpt_more and--if there's a custom excerpt--filter get_the_excerpt to add our generated link to trimmed excerpts AND custom excerpts but NOT posts less than the excerpt length.

#16 @iandstewart
15 years ago

For reference, the expected result of cautiously_fancy_excerpts.diff …

http://img.skitch.com/20100528-fpdwxinhncap6g1s31ewhc53is.jpg

#17 @wpmuguru
15 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [15040]) continue reading link on custom excerpt in TwentyTen, props iandstewart, fixes #13361

#18 @hakre
15 years ago

I still experience this on WP.com:

Sample Attachment Page

#19 @hakre
15 years ago

  • Keywords needs-patch added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Just tested against trunk as well, this is not fixed.

#20 @iandstewart
15 years ago

Checking if is_attachment() should correct that.

@iandstewart
15 years ago

Don't add continue reading link to attachment templates

#21 @nacin
15 years ago

  • Keywords commit added; needs-patch needs-testing removed

#22 @nacin
15 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

#23 @hakre
15 years ago

can confirm fixed on trunk based testbed here.

Note: See TracTickets for help on using tickets.