Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Justin Sainton

    (@justinsainton)

    Sure, you could put something like this in your theme’s functions.php file:

    function francesco_disable_wpsc_comments() {
    	remove_post_type_support( 'wpsc-product', 'comments'  );
    }
    add_action( 'init', 'francesco_disable_wpsc_comments' );

    Hope that helps!

    Thread Starter Francesco

    (@nym77)

    Thx Justin, it works perfectly!

    Can we hope in a checkbox in a coming version? ??

    Plugin Author Justin Sainton

    (@justinsainton)

    We are pretty stringent on adding settings. It’s part of our inherited philosophy from WordPress; decisions, not options.

    That said, looking at our code, comments are not supported by default, so it sounds like another plugin or theme might be adding comment support to all public post types or something like that. Worth checking on, but for now, I’m glad this is working for you ??

    This is the filter I put into my sites when comments need to be off on products

    /**
     * Filter whether the current post is open for comments.
     *
     * @param bool        $open    Whether the current post is open for comments.
     * @param int|WP_Post $post_id The post ID or WP_Post object.
     */
    function wpec_no_single_product_page_comments( $open, $post_id ) {
    	if ( $open && is_singular() ) {
    		$post_type = get_post_type( $post_id );
    		if ( 'wpsc-product' == $post_type ) {
    			$open = false;
    		}
    	}
    
    	return $open;
    }
    
    add_filter( 'comments_open', 'wpec_no_single_product_page_comments', 10, 2 );
    Thread Starter Francesco

    (@nym77)

    FYI, In order to avoid to lose this information i created a blog post here

    https://technicality.host-for.me/2015/04/wp-e-commerce-disable-comments-in-products/

    once again thx!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Disable comment in products’ is closed to new replies.