Hi, I’m trying to limit the number of comments that are displayed for a product so it doesn’t all load in the DOM.
I am trying to use the query editor but haven’t been able to make it work. I created a product template and set the display conditions to a product I know has many reviews / comments.
In WordPress, the comment is not a post type, and you CANNOT query the comment by using Bricks QueryEditor. (QueryEditor is only support WP_Query, WP_Term_Query or WP_User_Query)
You can only get the comments by using WP_Comment_Query
Also, if you want to do it by using Bricks Query Loop, the only way is to create a custom Query Loop
Related hooks:
You will still need to create some custom functions so you can output the comment content date etc. inside the loop.
If your main problem is the large amount of comments in a single product, you should be able to separate them by setting pagination in WP Admin > Settings > Discussions
That solved the DOM problem. I was definitely over complicating it. To be honest, I haven’t looked at those basic wordpress discussion controls in a very long time and I forgot they were there.
As a low priority nice to have, it’d be great to make the pagination an ajax load more button rather reloading the page. However, it’s definitely not worth the effort at the moment to write those custom queries.