很多个人博客希望WordPress主题的侧边栏能够显示新回复的留言,这样也会带来一点的点击浏览.
WordPress主题开发如何实现:
<?php $comments = get_comments('status=approve&number=5&order=asc'); foreach($comments as $comment) : $output = '<li>' .get_comment_author().'发表评论说:<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . $comment->comment_content . '</a></li>'; echo $output; endforeach;?>
里面的样式可以自行修改为你想要的样式使他和你的WordPress主题的侧边栏协调.