motayeb/woocommerce/single-product/review.php
Kazem Alghasi f408faac54 build(theme): scaffold initial theme directory structure and assets
Initialize the base WordPress theme files, including core template
hierarchy (index, page, single, archive, 404), WooCommerce template
overrides, and essential asset directories.
2026-08-15 22:11:08 +03:30

36 lines
1.9 KiB
PHP

<?php
/**
* نمایش تکی نظر - کاملاً سفارشی
*/
defined( 'ABSPATH' ) || exit;
global $comment;
$rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) );
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<div class="bg-cream-50 dark:bg-dark-card rounded-2xl p-5 border border-cream-200/50 dark:border-dark-border/50">
<div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-3">
<div class="w-10 h-10 bg-forest-100 dark:bg-forest-800 rounded-full flex items-center justify-center font-bold text-sm text-forest-500 dark:text-forest-300">
<?php echo mb_substr( get_comment_author( $comment ), 0, 1 ); ?>
</div>
<div>
<div class="font-bold text-sm text-earth-400 dark:text-dark-text"><?php echo esc_html( get_comment_author( $comment ) ); ?></div>
<div class="text-[10px] text-cream-500 dark:text-dark-muted"><?php echo get_comment_date( 'Y/m/d' ); ?></div>
</div>
</div>
<!-- ستاره‌های تمیز و متنی -->
<?php if ( $rating && wc_review_ratings_enabled() ) : ?>
<div class="flex text-honey-400 text-sm" style="letter-spacing: 2px;">
<?php echo str_repeat('★', $rating) . str_replace('★', '☆', str_repeat('★', 5 - $rating)); ?>
</div>
<?php endif; ?>
</div>
<?php if ( $comment->comment_approved == '0' ) : ?>
<p class="text-xs text-amber-500 mb-2"><?php esc_html_e( 'Your review is awaiting approval', 'woocommerce' ); ?></p>
<?php endif; ?>
<div class="text-sm text-cream-500 dark:text-dark-muted leading-7">
<?php echo wpautop( esc_html( get_comment_text( $comment ) ) ); ?>
</div>
</div>
</li>