Tidied comment styling and only show stars if set Closes #2906.
This commit is contained in:
parent
e18507f8ea
commit
9f1c14c682
File diff suppressed because one or more lines are too long
|
@ -740,7 +740,7 @@ p.demo_store {
|
|||
background:none;
|
||||
list-style: none;
|
||||
li {
|
||||
padding: 00;
|
||||
padding: 0;
|
||||
margin: 0 0 20px;
|
||||
border: 0;
|
||||
position: relative;
|
||||
|
@ -768,6 +768,7 @@ p.demo_store {
|
|||
border: 1px solid darken( @secondary, 3 );
|
||||
.border_radius(4px);
|
||||
padding: 1em 1em 0;
|
||||
.clearfix();
|
||||
p {
|
||||
margin: 0 0 1em;
|
||||
}
|
||||
|
@ -776,6 +777,20 @@ p.demo_store {
|
|||
}
|
||||
}
|
||||
}
|
||||
ul.children {
|
||||
list-style: none outside;
|
||||
margin: 20px 0 0 50px;
|
||||
|
||||
.star-rating {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
#respond {
|
||||
border: 1px solid darken( @secondary, 3 );
|
||||
.border_radius(4px);
|
||||
padding: 1em 1em 0;
|
||||
margin: 20px 0 0 50px;
|
||||
}
|
||||
}
|
||||
.commentlist > li:before {
|
||||
content: "";
|
||||
|
|
|
@ -60,7 +60,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|||
</div>
|
||||
<?php endif;
|
||||
|
||||
echo '<p class="add_review"><a href="#review_form" class="inline show_review_form button" title="' . __( 'Add Your Review', 'woocommerce' ) . '">' . __( 'Add Review', 'woocommerce' ) . '</a></p>';
|
||||
echo '<p class="add_review"><a href="#review_form" class="inline show_review_form button">' . __( 'Add Review', 'woocommerce' ) . '</a></p>';
|
||||
|
||||
$title_reply = __( 'Add a review', 'woocommerce' );
|
||||
|
||||
|
@ -77,23 +77,24 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|||
echo '</div><div id="review_form_wrapper"><div id="review_form">';
|
||||
|
||||
$comment_form = array(
|
||||
'title_reply' => $title_reply,
|
||||
'title_reply' => $title_reply,
|
||||
'title_reply_to' => __( 'Leave a Reply to %s', 'woocommerce' ),
|
||||
'comment_notes_before' => '',
|
||||
'comment_notes_after' => '',
|
||||
'fields' => array(
|
||||
'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'woocommerce' ) . '</label> ' . '<span class="required">*</span>' .
|
||||
'comment_notes_after' => '',
|
||||
'fields' => array(
|
||||
'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'woocommerce' ) . ' <span class="required">*</span></label> ' .
|
||||
'<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" aria-required="true" /></p>',
|
||||
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email', 'woocommerce' ) . '</label> ' . '<span class="required">*</span>' .
|
||||
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email', 'woocommerce' ) . ' <span class="required">*</span></label> ' .
|
||||
'<input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" aria-required="true" /></p>',
|
||||
),
|
||||
'label_submit' => __( 'Submit Review', 'woocommerce' ),
|
||||
'logged_in_as' => '',
|
||||
'label_submit' => __( 'Submit', 'woocommerce' ),
|
||||
'logged_in_as' => '',
|
||||
'comment_field' => ''
|
||||
);
|
||||
|
||||
if ( get_option('woocommerce_enable_review_rating') == 'yes' ) {
|
||||
|
||||
$comment_form['comment_field'] = '<p class="comment-form-rating"><label for="rating">' . __( 'Rating', 'woocommerce' ) .'</label><select name="rating" id="rating">
|
||||
$comment_form['comment_field'] = '<p class="comment-form-rating"><label for="rating">' . __( 'Your Rating', 'woocommerce' ) .'</label><select name="rating" id="rating">
|
||||
<option value="">'.__( 'Rate…', 'woocommerce' ).'</option>
|
||||
<option value="5">'.__( 'Perfect', 'woocommerce' ).'</option>
|
||||
<option value="4">'.__( 'Good', 'woocommerce' ).'</option>
|
||||
|
|
|
@ -6,45 +6,47 @@
|
|||
*
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 1.6.4
|
||||
* @version 2.1.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
global $post;
|
||||
$rating = esc_attr( get_comment_meta( $GLOBALS['comment']->comment_ID, 'rating', true ) );
|
||||
$rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) );
|
||||
?>
|
||||
<li itemprop="reviews" itemscope itemtype="http://schema.org/Review" <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
|
||||
|
||||
<div id="comment-<?php comment_ID(); ?>" class="comment_container">
|
||||
|
||||
<?php echo get_avatar( $GLOBALS['comment'], $size='60' ); ?>
|
||||
<?php echo get_avatar( $comment, '60' ); ?>
|
||||
|
||||
<div class="comment-text">
|
||||
|
||||
<?php if ( get_option('woocommerce_enable_review_rating') == 'yes' ) : ?>
|
||||
<?php if ( $rating && 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 ) ) / 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>
|
||||
<span style="width:<?php echo ( $rating / 5 ) * 100; ?>%"><strong itemprop="ratingValue"><?php echo $rating; ?></strong> <?php _e( 'out of 5', 'woocommerce' ); ?></span>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($GLOBALS['comment']->comment_approved == '0') : ?>
|
||||
<?php if ( $comment->comment_approved == '0' ) : ?>
|
||||
|
||||
<p class="meta"><em><?php _e( 'Your comment is awaiting approval', 'woocommerce' ); ?></em></p>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<p class="meta">
|
||||
<strong itemprop="author"><?php comment_author(); ?></strong> <?php
|
||||
|
||||
if ( get_option('woocommerce_review_rating_verification_label') == 'yes' )
|
||||
if ( woocommerce_customer_bought_product( $GLOBALS['comment']->comment_author_email, $GLOBALS['comment']->user_id, $post->ID ) )
|
||||
if ( woocommerce_customer_bought_product( $comment->comment_author_email, $comment->user_id, $comment->comment_post_ID ) )
|
||||
echo '<em class="verified">(' . __( 'verified owner', 'woocommerce' ) . ')</em> ';
|
||||
|
||||
?>– <time itemprop="datePublished" datetime="<?php echo get_comment_date('c'); ?>"><?php echo get_comment_date(__( get_option('date_format'), 'woocommerce' )); ?></time>:
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<div itemprop="description" class="description"><?php comment_text(); ?></div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div itemprop="description" class="description"><?php comment_text(); ?></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1324,7 +1324,7 @@ add_action( 'comment_feed_where', 'woocommerce_exclude_order_comments_from_feed_
|
|||
*/
|
||||
function woocommerce_downloadable_product_permissions( $order_id ) {
|
||||
|
||||
if ( get_post_meta( $order_id, __( 'Download Permissions Granted', 'woocommerce' ), true ) == 1 )
|
||||
if ( get_post_meta( $order_id, __( 'Download Permissions Granted', 'woocommerce' ), true ) == 1 )
|
||||
return; // Only do this once
|
||||
|
||||
$order = new WC_Order( $order_id );
|
||||
|
|
|
@ -740,7 +740,7 @@ if ( ! function_exists( 'woocommerce_comments' ) ) {
|
|||
*/
|
||||
function woocommerce_comments( $comment, $args, $depth ) {
|
||||
$GLOBALS['comment'] = $comment;
|
||||
woocommerce_get_template( 'single-product/review.php' );
|
||||
woocommerce_get_template( 'single-product/review.php', array( 'comment' => $comment, 'args' => $args, 'depth' => $depth ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue