star ratings without images.
This commit is contained in:
parent
789361102e
commit
192a8c5421
File diff suppressed because one or more lines are too long
|
@ -803,15 +803,35 @@ p.demo_store {
|
|||
/* Star rating */
|
||||
.star-rating {
|
||||
float: right;
|
||||
width: 80px;
|
||||
height: 16px;
|
||||
background: url(../images/star.png) repeat-x left 0;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
height: 1em;
|
||||
line-height: 1em;
|
||||
font-size: 1em;
|
||||
width: 5.4em;
|
||||
&:before {
|
||||
content: "\2606\2606\2606\2606\2606";
|
||||
color: darken( @secondary, 10 );
|
||||
float: left;
|
||||
top: 0;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
span {
|
||||
background: url(../images/star.png) repeat-x left -32px;
|
||||
height: 0;
|
||||
padding-top: 16px;
|
||||
overflow:hidden;
|
||||
float:left;
|
||||
overflow: hidden;
|
||||
float: left;
|
||||
top: 0;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
padding-top: 1.5em;
|
||||
}
|
||||
span:before {
|
||||
content: "\2605\2605\2605\2605\2605";
|
||||
top: 0;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1665,13 +1685,13 @@ p.demo_store {
|
|||
}
|
||||
}
|
||||
}
|
||||
.star-rating {
|
||||
/*.star-rating {
|
||||
background-image: url(../images/star@2x.png);
|
||||
background-size: 16px 48px;
|
||||
span {
|
||||
background-image: url(../images/star@2x.png);
|
||||
background-size: 16px 48px;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
|
@ -955,13 +955,11 @@ abstract class WC_Product {
|
|||
if ( $location )
|
||||
$location = '_' . $location;
|
||||
|
||||
$star_size = apply_filters( 'woocommerce_star_rating_size' . $location, 16 );
|
||||
|
||||
$average_rating = $this->get_average_rating();
|
||||
|
||||
$rating_html = '<div class="star-rating" title="' . sprintf( __( 'Rated %s out of 5', 'woocommerce' ), $average_rating ) . '">';
|
||||
|
||||
$rating_html .= '<span style="width:' . ( $average_rating * $star_size ) . 'px"><span class="rating">' . $average_rating . '</span> ' . __( 'out of 5', 'woocommerce' ) . '</span>';
|
||||
$rating_html .= '<span style="width:' . ( ( $average_rating / 5 ) * 100 ) . '%"><strong class="rating">' . $average_rating . '</strong> ' . __( 'out of 5', 'woocommerce' ) . '</span>';
|
||||
|
||||
$rating_html .= '</div>';
|
||||
|
||||
|
|
|
@ -82,13 +82,9 @@ class WC_Widget_Recent_Reviews extends WP_Widget {
|
|||
|
||||
$_product = get_product( $comment->comment_post_ID );
|
||||
|
||||
$star_size = intval( apply_filters( 'woocommerce_star_rating_size_recent_reviews', 16 ) );
|
||||
|
||||
$rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) );
|
||||
|
||||
$rating_html = '<div class="star-rating" title="' . sprintf(__( 'Rated %d out of 5', 'woocommerce' ), $rating) . '">
|
||||
<span style="width:' . ( $rating * $star_size ) . 'px">' . $rating . ' ' . __( 'out of 5', 'woocommerce' ) . '</span>
|
||||
</div>';
|
||||
$rating_html = $_product->get_rating_html();
|
||||
|
||||
echo '<li><a href="' . esc_url( get_comment_link( $comment->comment_ID ) ) . '">';
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|||
|
||||
echo '<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">';
|
||||
|
||||
echo '<div class="star-rating" title="'.sprintf(__( 'Rated %s out of 5', 'woocommerce' ), $average).'"><span style="width:'.($average*16).'px"><span itemprop="ratingValue" class="rating">'.$average.'</span> '.__( 'out of 5', 'woocommerce' ).'</span></div>';
|
||||
echo '<div class="star-rating" title="'.sprintf(__( 'Rated %s out of 5', 'woocommerce' ), $average).'"><span style="width:'.( ( $average / 5 ) * 100 ) . '%"><strong itemprop="ratingValue" class="rating">'.$average.'</strong> '.__( 'out of 5', 'woocommerce' ).'</span></div>';
|
||||
|
||||
echo '<h2>'.sprintf( _n('%s review for %s', '%s reviews for %s', $count, 'woocommerce'), '<span itemprop="ratingCount" class="count">'.$count.'</span>', wptexturize($post->post_title) ).'</h2>';
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ $rating = esc_attr( get_comment_meta( $GLOBALS['comment']->comment_ID, 'rating',
|
|||
<?php if ( get_option('woocommerce_enable_review_rating') == 'yes' ) : ?>
|
||||
|
||||
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" class="star-rating" title="<?php echo sprintf(__( 'Rated %d out of 5', 'woocommerce' ), $rating) ?>">
|
||||
<span style="width:<?php echo intval( get_comment_meta( $GLOBALS['comment']->comment_ID, 'rating', true ) ) * 16; ?>px"><span itemprop="ratingValue"><?php echo intval( get_comment_meta( $GLOBALS['comment']->comment_ID, 'rating', true ) ); ?></span> <?php _e( 'out of 5', 'woocommerce' ); ?></span>
|
||||
<span style="width:<?php echo ( intval( get_comment_meta( $GLOBALS['comment']->comment_ID, 'rating', true ) ) / 5 ) * 100; ?>%"><strong itemprop="ratingValue"><?php echo intval( get_comment_meta( $GLOBALS['comment']->comment_ID, 'rating', true ) ); ?></strong> <?php _e( 'out of 5', 'woocommerce' ); ?></span>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
|
Loading…
Reference in New Issue