Forum Replies Created

Viewing 3 replies - 286 through 288 (of 288 total)
  • Thread Starter Jason Ryan

    (@viablethought)

    Hmmm, I think with the way WooCommerce works I think every Product displays on an archive page, although I may be mistaken.

    Thread Starter Jason Ryan

    (@viablethought)

    Also, I updated the code by swapping the title to show “Not Rated Yet” when a Review hasn’t been left yet on a Product. Again I would like to move this to my child theme functions.php but thats where I get lost a bit.

    /**
    	 * Returns the product rating in html format.
    	 *
    	 * @param string $rating (default: '')
    	 *
    	 * @return string
    	 */
    	public function get_rating_html( $rating = null ) {
    		$rating_html = '';
    
    		if ( ! is_numeric( $rating ) ) {
    			$rating = $this->get_average_rating();
    		}
    
    		if ( $rating > 0 ) {
    			$title = sprintf( __( 'Rated %s out of 5', 'woocommerce' ), $rating );
    		} else {
    			$title = 'Not yet rated';
    		}
    
    		if ( $rating > -1 ) {
    
    			$rating_html  = '<div class="star-rating" title="' . $title . '">';
    
    			$rating_html .= '<span style="width:' . ( ( $rating / 5 ) * 100 ) . '%"><strong class="rating">' . $rating . '</strong> ' . __( 'out of 5', 'woocommerce' ) . '</span>';
    
    			$rating_html .= '</div>';
    		}
    
    		return apply_filters( 'woocommerce_product_get_rating_html', $rating_html, $rating );
    	}

    Thanks

    Thread Starter Jason Ryan

    (@viablethought)

    Nevermind, this issue was coming from another plugin, which has been banished to the depths of hell…..never to be seen again.

Viewing 3 replies - 286 through 288 (of 288 total)