X
X
xFreake2016-09-28 11:11:44
WordPress
xFreake, 2016-09-28 11:11:44

How to display avatars in the last comments?

The last comments are displayed by me with such an uncomplicated script

$args = array(
            'number' => 3,
            'orderby' => 'comment_date',
            'order' => 'DESC',
            //'post_id' => 0,
            'type' => 'comment',
        );

        if( $comments = get_comments( $args ) ){
            $html .= '<ul>';
            foreach( $comments as $comment ){
                $comm_link = get_comment_link( $comment->comment_ID ); // может быть тяжелый запрос ...
                $comm_short_txt = mb_substr( strip_tags( $comment->comment_content ), 0 ) ;

                $html .=  '
<li>
<h3>'. $comment->comment_author .': </h3>
<a rel="nofollow" href="'. $comm_link .'">'. $comm_short_txt .'</a>
</li>';
            }
            $html .=  '</ul>';
        }


    return $html;

How can I display also avtarki there too

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question