0

there are 3 types of comments in the woocommerce reviews tab: reviews(for customers who bought already), questions (for those who don't bought yet) and comments (it's the reply from shop manager). But I don't know how to output questions and their corresponding comments in the same list like:

Question 1 - Comment 1 --Comment 1.1 Question 2 - Comment 2

while there are some other comments (reply) for reviews. My code is:

<ol class="commentlist">
        <?php wp_list_comments( array(
                'callback'     => 'wc_product_reviews_XH_contributions',
                'max_depth'    => 2,

'type' => 'questions', 'end-callback' => 'wc_product_reviews_XH_comment_form', ) ); ?>

In this case I only get the questions without comments below. I changed the code into:

$comments = get_comments( array(
'type__in' => array('questions','comments'),
'status' => 'approve',

) );

<ol class="commentlist">
        <?php wp_list_comments( array(
                'callback'     => 'wc_product_reviews_XH_contributions',
                'max_depth'    => 2,
                'end-callback' => 'wc_product_reviews_XH_comment_form',
            )  , $comments); ?>
    </ol>

However, I get all comments including those below reviews.

Is there anyway to only get those questions with their comments?

Thanks

Jie

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.