[wp-trac] [WordPress Trac] #16372: Abstract the word-trimming logic in wp_trim_excerpt

WordPress Trac wp-trac at lists.automattic.com
Tue Jan 25 21:21:24 UTC 2011


#16372: Abstract the word-trimming logic in wp_trim_excerpt
-------------------------+----------------------------
 Reporter:  nacin        |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Future Release
Component:  Formatting   |    Version:
 Severity:  normal       |   Keywords:
-------------------------+----------------------------
 Currently, wp_trim_excerpt() takes a $text value, but if it exists, then
 all it does is apply the wp_trim_except filter. If it's empty, then $text
 becomes get_the_content(). All of the logic for actually splitting up
 words are trapped in this conditional.

 I suggest a new function that wp_trim_excerpt can call. Here's the
 suggested function definition:

 `function wp_trim_words( $text, $length = 55, $more = '[...]' )`

 The length and more default values are what gets passed to the
 excerpt_length and excerpt_more filters. But I'd expect the filters
 themselves to remain in wp_trim_excerpt.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16372>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list