#29623 closed enhancement (wontfix)
Supporting number of characters for excerpts
Reported by: | valeriosza | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | |
Focuses: | template | Cc: |
Description
I tried looking for something here on trac and found and sorry for the English.
The the_excerpt does not have native functions to limit the amount of characters. Something useful when you have to use different amounts of characters on each page.
Example the_excerpt (50, words)
for use on front page
and the_excerpt (100, characters)
for use in category.php
There is something ever talked about it?
Change History (9)
#2
@
9 years ago
@obenland - Twenty Eleven modifies the number of words but not characters which is why this ticket was opened.
#3
@
9 years ago
There are more filters than the one Twenty Eleven uses, that was just an example. 'wp_trim_excerpt'
passes the entire excerpt text, as do 'get_the_excerpt'
and 'the_excerpt'
.
#4
@
7 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
Closing this after no traction for over 2 years. Feel free to reopen when a patch emerges, otherwise filters exist to modify excerpts.
#5
@
7 years ago
I think there is interest for this. I have had a few themes create their own solution so that they limit the number of character outputted in the excerpt while reviewing themes for the theme review team.
I suppose the ticket is not easy to find as the title is not ideal. Could someone change the title to something like "Supporting number of characters for excerpts" Was able to do it myself.
wp_trim_words()
currently supports characters but only if the string 'words'
is translated as 'characters'
#6
@
7 years ago
- Summary changed from the_excerpt parameters to Supporting number of characters for excerpts
Excerpts come with a few filters, that lets you do pretty much anything, if the default output doesn't work for your specific needs. Twenty Eleven actually uses one of them to modify it.
There is
excerpt_length
andexcerpt_more
inwp_trim_excerpt()
(#), and of courseget_the_excerpt
andthe_excerpt
in the excerpt template tags (#).Since it's so highly customizable through filters, it shouldn't really need additional arguments to achieve that.