Hi I have retrieved comments by custom code in my template file as the following
<?php $comments = get_comments();?>
<?php foreach($comments as $comment) : ?>
<?php if ($comment->comment_approved == '0') : ?>
<p class="waiting-message">Your comment is awaiting moderation.</p>
<?php endif; ?>
<?php echo $comment->comment_author; ?>
<?php echo comment_date('n M y'); ?>
<?php echo $comment->comment_content;?>
<?php endforeach; ?>
Now I don’t know how to do numbered pagination like << 1, 2, 3 >>… Please help me
your comment will be like this
and pagination like
I was trying to accomplish something similar to the original poster: gather all the comments on a WordPress site and display them in a paginated layout.
The above answer was very helpful, but I could never get it to completely work on my site. I tried a little different approach and it works for me. I’m posting the code here in case it’s helpful to others.
Just in case someone’s in my situation:
I was looking to do exactly what the OP was trying to achieve, but on a product single page in Woocommerce: nothing worked. One of the main issues was that, for some reason, Woocommerce will redirect to the original URL if a public query variable is used. So, starting from @anstrangel0ver’s solution, here’s what I did:
Since using ‘page’ as a query var was out of the question, I added one via my functions.php file:
I then slightly modified his code, pasted on my product page:
And then a foreach to create my custom structure: