[resolved] How to limit word or character count with recent comments (with get_comments()) (3 posts)

  1. knijia
    Posted 4 years ago #

    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

  2. Michael
    Forum Moderator
    Posted 4 years ago #

    you could use:

    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 ) {
  3. knijia
    Posted 4 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.