WordPress.org

Support

Support » Plugins and Hacks » Hacks » apply comment excerpt

apply comment excerpt

  • canutedechou
    Member

    @canutedechou

    im trying to show the last 2 comments from a post
    but, i want to apply a excerpt to a comment
    the problem is, i have the next function, but any time i want to apply the excerpt, it doesnt show anything

    <?php $comments = get_comments('post_id=' . $post->ID . '&number=2');
    		if($comments) {
    		foreach($comments as $comment) :
    		echo($comment->comment_author .
    		' says: <br />' . $comment->comment_content . '<br />'); endforeach;
    		} ?>

    and where it says $comment->comment_content i need to put the excerpt
    any idea?
    thanks

Viewing 1 replies (of 1 total)
  • canutedechou
    Member

    @canutedechou

    i just solved with these

    <?php $comments = get_comments('post_id=' . $post->ID . '&number=2');
    		if($comments) {
    		foreach($comments as $comment) :
    		echo('<div class="author">' . $comment->comment_author .
    		' says: </div><div class="comment-excerpt">' . get_comment_excerpt( $comm->comment_ID ) . '</div>');
    		endforeach;
    		} ?>

    i leave the code if someone needs it

Viewing 1 replies (of 1 total)
  • The topic ‘apply comment excerpt’ is closed to new replies.