Opened 10 years ago
Closed 9 years ago
#27526 closed enhancement (fixed)
Introduce comment excerpt length filter
Reported by: | dannydehaan | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 3.8 |
Component: | Comments | Keywords: | has-patch |
Focuses: | Cc: |
Description
Hi,
I needed this for a client. I could have created a new function in my functions.php file, but why don't create a filter so it's much simpler to set the length for the comment excerpt.
I've also fixed some strange names in the functions like $blah and use_dotdotdot.
Attachments (6)
Change History (18)
#1
@
10 years ago
Looks good. If we're going to fix spacing, we should add spaces to $i<$k
as well.
This will need hook documentation. Also, I'd probably keep "20" in the main function docs, as it's the default.
#2
follow-up:
↓ 4
@
10 years ago
- Keywords needs-docs added
See existing hook documentation in core for reference, as well as the inline documentation standards for hooks.
#4
in reply to:
↑ 2
@
10 years ago
@DrewAPicture
Sorry, i didn't mentioned your comment. Fixed this now. Thanks!
#5
follow-up:
↓ 6
@
10 years ago
@nacin,
I did found out, that when your comment is like the default comment from Mr. WordPress, the excerpt length will be 21 words. This is because of the "\n" or "\r" that is in the comment. I've fixed this by replacing the \n \r characters for a space. I've also found an issue when the ellipsis are used, the comment excerpt will look like this:
Hi, this is a comment. To delete a comment, just log in and view the post's comments. There you will …
Notice the space between will and … I've fixed this now by imploding the words with a space so you will not have this behaviour.
#6
in reply to:
↑ 5
@
10 years ago
Replying to dannydehaan:
Notice the space between will and … I've fixed this now by imploding the words with a space so you will not have this behaviour.
We can just use trim()
before adding the ellipsis (like we did for wp_html_excerpt()
in [24214]).
Fix for 27526