Support » Plugins and Hacks » Hacks » How to limit word or character count with recent comments (with get_comments())

  • Resolved knijia

    (@knijia)


    Hi, i’d like to know if it’s possible to limit the lengh of character in comments generated with get_comments() without plugin.
    I wish i could do this to display for example the 5 last comments on my homepage but with the same amount of word or character for each comment.
    Thanks <3

Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael

    (@alchymyth)

    Forum Moderator

    you could use:
    http://codex.wordpress.org/Function_Reference/comment_excerpt

    however, this in turn is calling ‘get_comments()’ as well, so you are kind of over-using the function.

    look instead into:

    /wp-includes/comment-template.php from line 407, how the internal function generates a comment excerpt:

    function get_comment_excerpt( $comment_ID = 0 ) {
    ...

    Hi alchymyth,
    thanks for your answer. It’s exactly what i was searching for. I’m not used with comments functions on wordpress. Tks again <3

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to limit word or character count with recent comments (with get_comments())’ is closed to new replies.