| | |
| | | <?php |
| | | foreach ($reviews as $review) { |
| | | $reviewer = $review['reviewer']['displayName'] ?? 'Anonymous'; |
| | | $reviewer = strtok($reviewer, ' '); |
| | | $profilePhoto = $review['reviewer']['profilePhotoUrl'] ?? ''; |
| | | $rating = $review['starRating'] ?? 0; |
| | | $rating = match($rating) { |
| | |
| | | $date = $review['updateTime'] ?? ''; |
| | | ?> |
| | | <li> |
| | | <article class="review"> |
| | | <header class="row btw"> |
| | | <blockquote class="review"> |
| | | <?php |
| | | // Review text |
| | | if (!empty($comment)) { ?> |
| | | <div class="content review"> |
| | | <?= apply_filters('wpautop', $comment) ?> |
| | | </div> |
| | | <?php } ?> |
| | | <cite class="row start nowrap"> |
| | | <?php if (!empty($profilePhoto)) { ?> |
| | | <img src="<?=esc_url($profilePhoto)?>" |
| | | alt="<?=esc_attr($reviewer)?>" |
| | |
| | | </div> |
| | | <?php } ?> |
| | | |
| | | <div class="col end"> |
| | | <h4><?= esc_html($reviewer)?></h4> |
| | | <div class="row start wrap"> |
| | | <p><?= esc_html($reviewer)?></p> |
| | | <?php |
| | | // Date |
| | | if ($showDate && !empty($date)) { |
| | |
| | | </div> |
| | | <?php } ?> |
| | | </div> |
| | | |
| | | </header> |
| | | <?php |
| | | // Review text |
| | | if (!empty($comment)) { ?> |
| | | <div class="review"> |
| | | <?= apply_filters('the_content', $comment) ?> |
| | | </div> |
| | | <?php } ?> |
| | | </article> |
| | | </cite> |
| | | </blockquote> |
| | | </li> |
| | | <?php |
| | | } |