Use wp_trim_words() in Recent Drafts widget. fixes #24292.

git-svn-id: http://core.svn.wordpress.org/trunk@24212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2013-05-08 23:06:41 +00:00
parent 72478e1bce
commit 08bef7a3cb

View File

@ -589,8 +589,8 @@ function wp_dashboard_recent_drafts( $drafts = false ) {
$url = get_edit_post_link( $draft->ID );
$title = _draft_or_post_title( $draft->ID );
$item = "<h4><a href='$url' title='" . sprintf( __( 'Edit &#8220;%s&#8221;' ), esc_attr( $title ) ) . "'>" . esc_html($title) . "</a> <abbr title='" . get_the_time(__('Y/m/d g:i:s A'), $draft) . "'>" . get_the_time( get_option( 'date_format' ), $draft ) . '</abbr></h4>';
if ( $the_content = preg_split( '#[\r\n\t ]#', strip_tags( $draft->post_content ), 11, PREG_SPLIT_NO_EMPTY ) )
$item .= '<p>' . join( ' ', array_slice( $the_content, 0, 10 ) ) . ( 10 < count( $the_content ) ? '&hellip;' : '' ) . '</p>';
if ( $the_content = wp_trim_words( $draft->post_content, 10 ) )
$item .= '<p>' . $the_content . '</p>';
$list[] = $item;
}
?>