Answer the question
In order to leave comments, you need to log in
List of recent comments with the exclusion of those from articles of a certain category and vice versa in WordPress, how?
Good day.
There is such a code.
$comment_len = 140;
$comments = get_comments('status=approve&number=5');
if ($comments) {
foreach ($comments as $comment) {
?>
<li>
<?php echo get_avatar($comment,$size='50' ); ?>
<?php echo $comment->comment_author; ?>
<?php
$d = "j F Y в H:i";
$comment_ID = $comment->comment_ID;
$comment_date = get_comment_date( $d, $comment_ID );
echo $comment_date;
?>
<a href="<?php echo get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID; ?>"><?php echo mb_substr( strip_tags( $comment->comment_content ), 0, 75 ); ?>...</a>
<a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo get_the_title($comment->comment_post_ID); ?></a>
</li>
<?php
}
} else {
echo "<li>Комментарии отсутствуют</li>";
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question