Typecho 在独立页面中获取站点所有评论列表,支持翻页

Typecho教程 2020-09-14 176℃ 9 0




查库,typecho_comments表,这次我没有用之前的 push 方式来获取Winget对象,继承了Widget_Abstract_Comments类,可以直接使用Typecho_Widget::widget()方法来调用对象,比较符合Typecho的设计思路。重写了翻页代码,完美支持翻页。




<?php $comments = Typecho_Widget::widget('Widget_Comments_List@page-comments', 'ignoreAuthor=true'); ?>
<?php while ($comments->next()) : ?>
    <div class="comment-block">
        <a href="<?php $comments->permalink(); ?>"><?php Comment::excerpt(20, "...", $comments) ?></a>
<?php endwhile; ?>

评论 (9)

  1. see this page : Hi, i read your blog from time to time and i own a similar one and i was just curious if you get a lot
    of spam feedback? If so how do you stop it, any plugin or
    anything you can advise? I get so much lately it's driving me insane so any support is very much appreciated.
  2. click to read more : Hi there, just became alert to your blog through Google, and found that it's really
    informative. I'm gonna watch out for brussels. I will be grateful if
    you continue this in future. Numerous people will be benefited
    from your writing. Cheers!
  3. Thiết kế phòng hát karaoke : I got this website from my pal who told me on the topic of this site and now this time I am visiting this site and
    reading very informative articles or reviews here.
  4. Lil Durk : Hello I am so grateful I found your website, I really found you by accident, while
    I was researching on Google for something else, Regardless I am here now and would just like to say
    thanks for a marvelous post and a all round exciting
    blog (I also love the theme/design), I don’t have time to read it all at the moment but I have book-marked it and also
    added your RSS feeds, so when I have time I will be back to read more, Please do keep up the superb b.
  5. Sbobet99 : Howdy thiiѕ is kinda of off tօpic but Ι was wondering if blogs use
    WYSIWYG editors or if you have to manually code with HTML.I'm starting a blog so᧐n butt have no coding skills so I wantеd to get guidаnce
    from someone with experience. Any help would be enormously аpprecіated!