• Resolved tobilotta

    (@tobilotta)


    ive added a PHP code, which showes Product Reviews outside the “review-Tab”. it works perfectly fine.

    NOW: I want to PAGINATE or limit the reviews that has to be show on the product page. so lets say i want only 5 reviews to be show and then create SITE 2 to show other reviews. how to do?


    HEREs the code:

    /**
     * Remove Reviews tab
     */
    add_filter( 'woocommerce_product_tabs', 'wpd_wc_remove_product_review_tab', 15 );
    function wpd_wc_remove_product_review_tab( $tabs ) {
    	//Removing Reviews tab
    	if ( comments_open() ) {
    		unset( $tabs['reviews'] );
    	}
    	
    	return $tabs;
    }
    
    /**
     * Add custom CSS class to body tag.
     * We shall use this class into the CSS
     */
    add_filter( 'body_class', 'wpd_add_new_class' );
    function wpd_add_new_class( $classes ) {
    	if( comments_open() && is_singular( 'product' ) ) {
    		$classes[] = 'has-reviews';
    	}
    	
    	return $classes;
    }
    
    /**
     * Add the product reviews
     */
    add_action( 'woocommerce_after_single_product_summary', 'wpd_wc_add_product_reviews', 15 );
    function wpd_wc_add_product_reviews() {
    	global $product;
    
    	if ( ! comments_open() )
    		return;
    ?>
    	<div class="product-reviews">
    		<h2 class="review-title" itemprop="headline">
    			<?php printf( __( 'Reviews (%d)', 'woocommerce' ), $product->get_review_count() ); ?>
    		</h2>
    		<?php call_user_func( 'comments_template', 999 ); ?>
    	</div>
    	<div class="clearfix clear"></div>
    <?php
    }
Viewing 1 replies (of 1 total)
  • Hi @tobilotta,

    Great question. WooCommerce reviews are built on top of the WordPress commenting system. You can set the maximum number of reviews by going to Settings > Discussion. There is an option here to enable pagination and set the maximum number of comments per page.

    By default, WooCommerce should reflect these options. Let us know if you have any questions.

Viewing 1 replies (of 1 total)
  • The topic ‘[NSFW] REVIEWS OUTSIDE the Tab’ is closed to new replies.