I’m currently working on a WooCommerce theme which I have written a custom script to show the reviews rather than the default template.
The issue is I need to add the form separately to the theme which really needs to come from comments_template() so it will work correctly permanently with updates.
echo comments_template(); // Loads comments and form - I would like only the form
As some products can have hundreds or thousands of reviews I don’t want to simply hide them using CSS, I would prefer to use comments_template() just to get the form and not load in the comments as well.
Does anyone have any idea how to achieve this with a filter or other function?
2
Answers
As it doesn't look like there is a good solution for this here is the workaround I used.
In the Wordpress discussion settings I just changed the "Break comments into pages with 1 top level comments per page and the last page displayed by default" setting to 1 so it only shows 1 comment then hide the element via CSS.
This only works if you have custom code to show the comments, if you rely on the above for other comment sections as well it won't be a viable solution.
i dont no if this will help you but ive made a function so i can put the form anywhere on the site with a shortcode. this is the code
This code will also give the form a dropdown menu so the costumer can choose about what product they want to write a review about (the labels are in dutch so you need to change this to your own langue).