How to only show comments plus on certain post type

Hi, Is it possible to exclude the comments + from certain post types? Im setting a woo store and don't want the Facebook comments for the review of the products since they cannot rate with stars. So any hack or any idea how to accomplish this? Only on blog posts would be great to keep the comments + format.
Thanks a lot

  • PC

    Hello there Victor,

    Thanks for posting on the forums.

    Out of the box, the plugin displays comments on all the post types which use the comments template however I think we can use a work around by using a custom hook.

    If you use custom hook, the comment form is only displayed when you enter the hook in the code.

    So instead of the comments template, you can add the hook in the post template and that should help.

    Please let me know if you need my help in trying that process on your website.

    I hope that helps. Please feel free to ask if you have more questions on the same.

    Cheers, PC

  • Patrick

    Hi there @Victor

    I hope you are well today!

    First, I recommend updating your install of Comments Plus to the latest version 1.6.5

    Having an option to select on which post types the comment form should or should not be displayed would be great! I'll add that as a feature request. :slight_smile:

    In the meantime, you can add your own custom hooks to your theme's comments.php template. You'll need to locate the call to comment_form in that template.

    Then add your custom hooks before and after that call like so:

    <?php do_action('your_hook_before'); ?>
         <?php comment_form(); ?>
    <?php do_action('your_hook_after'); ?>

    Once you upload your modified comments.php template, you can add your custom hook names in the corresponding fields in Comments Plus settings.

    Of course, this will only work if Woo does not also use that template for product comments. :slight_smile:

    If it does, we'll need to write a conditional to only use those hooks if we're not viewing woo products.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.