Advertisement
geminilabs

[template example] reviews-summary.php

Dec 8th, 2021
1,254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.23 KB | None | 0 0
  1. <?php defined('ABSPATH') || die; ?>
  2.  
  3. <style>
  4.     .style-tripadvisor { max-width: none !important; font-size:14px !important; }
  5.     .style-tripadvisor .glsr-summary-text { margin-top: 0; }
  6. </style>
  7.  
  8. <?php
  9.  
  10. if ('style-tripadvisor' === $args['class']) :
  11.     $rating = round((int) wp_filter_nohtml_kses($context['rating']));
  12.     $levels = [
  13.         'Nothing',   // 0 star average
  14.         'Bad',       // 1 star average
  15.         'Okay',      // 2 star average
  16.         'Good',      // 3 star average
  17.         'Great',     // 4 star average
  18.         'Excellent', // 5 star average
  19.     ];
  20. ?>
  21.     <div class="glsr-summary-wrap">
  22.         <div class="{{ class }}">
  23.             <div style="display:flex; align-items: center;">
  24.                 <span style="flex:1 0 auto;">Our customers say</span>
  25.                 <span style="font-size:18px;font-weight:600; margin:0 .5em;"><?= $levels[$rating]; ?></span>
  26.                 {{ stars }}
  27.                 {{ text }}
  28.             </div>
  29.         </div>
  30.     </div>
  31. <?php else : ?>
  32.     <div class="glsr-summary-wrap">
  33.         <div class="{{ class }}">
  34.             {{ rating }}
  35.             {{ stars }}
  36.             {{ text }}
  37.             {{ percentages }}
  38.         </div>
  39.     </div>
  40. <?php endif; ?>
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement