dongshiliao7990 2018-10-12 17:19
浏览 51

自定义构建的评论插件 - 分页不起作用

I'm currently create a plugin that takes all comments from all products and places them under the review tab for all comments.

Inside Wordpress I have the following setting checked: Settings > Discussion > Break comments into pages with...

This enables pagination on the default comment section. I've added this code with my code but it doesn't enable pagination, even when I remove the If statement.

          <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) :
          echo '<nav class="woocommerce-pagination">';
          paginate_comments_links( apply_filters( 'woocommerce_comment_pagination_args', array(
              'prev_text' => '&larr;',
              'next_text' => '&rarr;',
              'type'      => 'list',
          ) ) );
          echo '</nav>';
      endif; ?>

I'm currently using this function to call all reviews into one:

function products_all_reviews(){
$args = array ('post_type' => 'product');
  $comments = get_comments( $args );
  wp_list_comments( apply_filters( 'woocommerce_product_review_list_args', array( 'callback' => 'woocommerce_comments' ) ), $comments );
}

What needs to be done to call/enable pagination properly? This is my first time creating plugin so the help is much appreciated

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 请提供一个符合要求的网页链接。
    • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
    • ¥15 网络设备配置与管理这个该怎么弄
    • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
    • ¥20 西门子S7-Graph,S7-300,梯形图
    • ¥50 用易语言http 访问不了网页
    • ¥50 safari浏览器fetch提交数据后数据丢失问题
    • ¥15 matlab不知道怎么改,求解答!!
    • ¥15 永磁直线电机的电流环pi调不出来
    • ¥15 用stata实现聚类的代码