• Resolved samcrawshaw

    (@samcrawshaw)


    Hello all,

    I’m struggling with paginate_comments_links()

    This is may code:

    <?php echo "\n\r";
    	echo "<div class='comment_pagination'><p>Page: ";
    	paginate_comments_links( array('prev_text' => '', 'next_text' => '') );
    	echo "</p></div><!--end comment_pagination-->\n\r"; ?>
    
    	<ol>
    
    	<?php foreach ($comments as $comment) : ?>
    
    		<li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>">
    			<?php //echo get_avatar( $comment, 32 ); ?>
    			<h4><?php comment_author_link() ?></h4>
    			<?php if ($comment->comment_approved == '0') : ?>
    			<p>Your comment is awaiting moderation.</p>
    			<?php endif; ?>
    			<cite><?php comment_date('F jS, Y, h:m:s') ?>  - <?php edit_comment_link('Click here to edit you comment');?></cite>
    			<?php comment_text() ?>
    		</li>
    
    	<?php
    		/* Changes every other comment to a different class */
    		$oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';
    	?>
    
    	<?php endforeach; /* end for each comment */ ?>
    
    	</ol>
    
    	<?php echo "\n\r";
    	echo "<div class='comment_pagination'><p>Page: ";
    	paginate_comments_links( array('prev_text' => '', 'next_text' => '') );
    	echo "</p></div><!--end comment_pagination-->\n\r"; ?>

    The pagination function is calling but it’s not splitting the comments. It has 12 comments on page one and then repeats the same comments for page two.

    I have enabled ‘Break comments into pages’ in Settings > Discussion and set the value at 10 so I should get one page with ten comments and the other with two, right?

    Any help much appreciated.

    Regards,
    Sam

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘paginate comments links’ is closed to new replies.