Custom comments

    $args = array('post_id'=>get_the_ID(), 'status'=> 'approve');
    $all_comm = get_comments($args);
    $per_page = get_option("comments_per_page");
    if(!$per_page)
    $per_page = 4;
    $cpage = get_query_var("cpage");
    if(!$cpage)
    $cpage = 1;
    if(round(count($all_comm)/$per_page) == 0)
    $total = 1;
    else
    $total = round(count($all_comm)/$per_page);
    $args_comments = array(
        'base' => add_query_arg( 'cpage', '%#%' ),
        'format' => "",
        'total' => $total,
        'current' => $cpage,
        'echo' => false,
        'add_fragment' => '#reviews'
    );
    $pagi_comments = paginate_comments_links($args_comments);
    $args = array('post_id'=>get_the_ID(), 'status'=> 'approve', 'number' => $per_page, 'offset' => $per_page*($cpage-1));
    $all_comm = get_comments($args);
    if($all_comm)
    foreach($all_comm as $as){ print_r($as); }
    echo $pagi_comments;

I hope it helps lot to you.

Leave a Comment