Rynald0s
(@rynald0s)
Automattic Happiness Engineer
Hi @saens!
It sounds like you would like to have the most recent reviews listed first. If that is the case, you can use some code, as outlined here:
https://jeffgrundy.com/woocommerce-display-newest-product-reviews-first/
This is how you can add custom code to your site the correct way:
http://rynaldo.com/how-to-add-custom-code-to-your-woocommerce-wordpress-site-the-right-way/
Cheers!
Thread Starter
saens
(@saens)
Hi, thanks. It does not do what I want. I want to always see the latest 10 reviews on the page. The splitting of the 10s (out of total) does not start with the latest 10, but with the oldest 10 working forwards in time.
The way it’s working now:
with 11 reviews, the latest review is on a page and the other 10 on the other page
with 20 reviews, it’s 10 on the first and 10 on the 2nd (OK)
with 21 reviews, it’s latest review on the first and 10 on the 2nd page and 1 on the third.
It’s also explained here: http://bassjobsen.weblogs.fm/wordpress-reverse-comment-order-paged-comments/
Neither code solutions in functions.php work for me, though.
The comments are sorted in reverse order, but when adding the X per page option the undesired splitting over pages happens.
-
This reply was modified 5 years, 11 months ago by
saens.
-
This reply was modified 5 years, 11 months ago by
saens.
con
(@conschneider)
Engineer
Hi there,
The comments are sorted in reverse order, but when adding the X per page option the undesired splitting over pages happens.
What happens when you try combinations of these settings:
https://d.pr/i/u037kl
and the custom code here: https://jeffgrundy.com/woocommerce-display-newest-product-reviews-first/
Kind regards,
con
(@conschneider)
Engineer
Hi there,
We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.
Kind regards,
Hi There – I am having the same issue! I’ve tried adding the code snippet to functions.php but like @saens the pagination breaks up the re-ordering so page 1 still has the oldest posts (just re-ordered newest to oldest) and page 3 has the newest.
Is there any other work arounds we can try?
Thread Starter
saens
(@saens)
Afaik there is not. Even though this is marked as resolved, the issue is not resolved.
Marking stuff as “resolved” when the topic starter hits a brick wall is fun π
I worked around it by creating my own code which pulls the comments from the database and shows them.
Any chance you want to share that code with me? π
@conschneider
Thread Starter
saens
(@saens)
The gist is:
Fil array with the comments
$comments = get_comments( array(
'post_id' => $product->get_id(),
'number' => $count_reviews,
'type' => 'review'
) );
then run through the loop and output the comment how you wish.
I put it together based off examples at stackexchange.com
My code won’t help you since it’s tailored to my specific demands. The basic is the same as the examples that you can find.