I am hoping someone can help me with comments pagination. I have the pagination working and the links point to the next page etc, but when clicking the page just refreshes. Here is my code so far and hoping someone can help me.
$pid = $post->ID;
$comment_query = "SELECT * FROM `wp_comments` WHERE comment_post_ID = ".$pid. " AND comment_approved = '1'";
$comments_array = $wpdb->get_results($comment_query, OBJECT);
if ($comments_array):
$cpp = 10; // Comments per page
$wp_query->comments = count($comments_array);
//echo $wp_query->found_posts;
$wp_query->max_num_pages = ceil($wp_query->comments / $cpp);
$on_page = intval(get_query_var('paged'));
if($on_page == 0){ $on_page = 1; }
$offset = ($on_page-1) * $cpp;
$wp_query->request = "
SELECT * FROM `wp_comments` WHERE comment_post_ID = ".$pid. " AND comment_approved = '1'
LIMIT $cpp
OFFSET $offset
";
$newcomments = $wpdb->get_results($wp_query->request, OBJECT);
?>
<div class="comments">
<?php if ($newcomments) : ?>
<a name="comments" id="comment_anchor"></a>
<h3 class="section-title"><?php _(comments_number('No <span>Comments</span>','1 <span>Comment</span>','% <span>Comments</span>')); ?></h3>
<ul class="comment-container">
<?php
foreach ($newcomments as $comment) :
full code: http://pastebin.com/md3zdpbd
Thanks
