get_comment_excerpt [ WordPress Function ]
get_comment_excerpt ( $comment_ID = 0 )
| Parameters: |
|
| Uses: |
|
| Returns: |
|
| Defined at: |
|
Similar Functions: comment_excerpt, get_comment_text, get_comment_meta, get_comment_count, get_the_excerpt
Retrieve the excerpt of the current comment.
Will cut each word and only output the first 20 words with '...' at the end. If the word count is less than 20, then no truncating is done and no '...' will appear.
Source
<?php
function get_comment_excerpt( $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
$comment_text = strip_tags($comment->comment_content);
$blah = explode(' ', $comment_text);
if (count($blah) > 20) {
$k = 20;
$use_dotdotdot = 1;
} else {
$k = count($blah);
$use_dotdotdot = 0;
}
$excerpt = '';
for ($i=0; $i<$k; $i++) {
$excerpt .= $blah[$i] . ' ';
}
$excerpt .= ($use_dotdotdot) ? '...' : '';
return apply_filters('get_comment_excerpt', $excerpt);
}
?>
Examples [ wp-snippets.com ]
Top Google Search Results
- get_comment_excerpt Wordpress hook details -- Adam Brown, BYU ...
WordPress hook directory get_comment_excerpt. Description. Applied to the comment excerpt read from the database by the get_comment_excerpt function ...
adambrown.info - get_comment_excerpt (WordPress Function) - WPSeek.com
WordPress lookup for get_comment_excerpt, a WordPress Function. wpseek. com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - get_comment_excerpt | A HitchHackers guide through WordPress
Feb 12, 2011 ... function get_comment_excerpt( $comment_ID = 0 ) { $comment = get_comment( ... return apply_filters('get_comment_excerpt', $excerpt); } ...
hitchhackerguide.com - WordPress › Support » Tags — get_comment_excerpt
Forums. Username or Email Address Password (forgot?) Register · WordPress › Support » get_comment_excerpt. Tag: get_comment_excerpt Add New » ...
wordpress.org