I've just started a business directory website. I'm using a custom post type for this. I'd like to extend the site's purpose by allowing visitors to add reviews on each business.
I therefore wondered if I could create another comments.php file for the purpose of visitors leaving reviews on single business pages while leaving the original comments.php for blog comments. Of course, I've tried a few review plug-ins without success!
I've just started a business directory website. I'm using a custom post type for this. I'd like to extend the site's purpose by allowing visitors to add reviews on each business.
I therefore wondered if I could create another comments.php file for the purpose of visitors leaving reviews on single business pages while leaving the original comments.php for blog comments. Of course, I've tried a few review plug-ins without success!
I don't know what your comments.php
looks like, so I cannot tell how to adapt your current code, but I can generally tell you how to approach this.
Normally, WP will assume that you want the latest comments of the current post. If you want something else, you start with the condition under which you want your second set of comments to show and add this to comments.php
: if (my_condition) { show second comments set; }
Now, you have to tell WP which set of comments to use. You need to set $args
which are available in the get_comments
function. There are too many options to describe here.
Once you have retrieved comments with $comments=get_comments($args);
you can feed them into the display function wp_list_comments($args,$comments)
. The $args
to this function determine how the comments are displayed. You can have them shown completely different from you other comments set.