dongling2038 2011-06-29 18:45
浏览 143

如何显示对wordpress评论的回复?

I have comments and each comment can have any number of replies. After a comment, but before the replies, I want to output how many replies there are. I have thought of two alternative ways to do this:

  1. (more involved in coding, but requires less knowledge of wordpress and the database) Make an array with strings and another with ints. Each position of both arrays corresponds to a nesting level in the comment/reply structure. When outputting a comment check what nesting level, or "$depth" you're on and "retire", or output, the information stored in the arrays up and until the same nesting level. Then add information of the current nesting level and of course update the int that's one nesting level above to count the current comment. -- Somewhat involved, my php skills or debugging tools are not great so this would take a couple of hours to do.

  2. (quick but must find some support/function in wordpress that gives me what I want) Just find some function in wordpress that displays/returns the number of replies that a comment has (including nested comments)

  • 写回答

3条回答

  • dongmu9253 2011-06-29 19:16
    关注

    I think there is not an available function in wordpress which does this. so you will have to hack it yourself. like Imoda suggests, use Sql query which can be done with $wpdb. there is a similar question you may want to take a look. https://wordpress.stackexchange.com/questions/16457/count-parent-comments-replies-separately

    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!