我想在评论列表中仅显示评论评分的数量,并在评论列表中显示此WooCommerce功能显示评论评分:
function wc_get_star_rating_html( $rating, $count = 0 ) {
$html = '<span style="width:' . ( ( $rating / 5 ) * 100 ) . '%">';
if ( 0 < $count ) {
/* translators: 1: rating 2: rating count */
$html .= sprintf( _n( 'Rated %1$s out of 5 based on %2$s customer rating', 'Rated %1$s out of 5 based on %2$s customer ratings', $count, 'woocommerce' ), '<strong class="rating">' . esc_html( $rating ) . '</strong>', '<span class="rating">' . esc_html( $count ) . '</span>' );
} else {
/* translators: %s: rating */
$html .= sprintf( esc_html__( 'Rated %s out of 5', 'woocommerce' ), '<strong class="rating">' . esc_html( $rating ) . '</strong>' );
}
$html .= '</span>';
return apply_filters( 'woocommerce_get_star_rating_html', $html, $rating, $count );
}
现在,当选择费率然后在评论列表中发送评论时,我希望按用户显示仅限数字。
例如:当选择3星提交评论然后在评论列表中而不是3星显示文本,如您选择3星。