Advertisement
jegtheme

review-box.php

Oct 18th, 2015
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.45 KB | None | 0 0
  1. <?php
  2.     $mean = get_post_meta(get_the_ID(),'rating_mean');
  3.  
  4.     if(isset($mean[0])) {
  5.         $mean = $mean[0];
  6.     } else {
  7.         $mean = 0;
  8.     }
  9. ?>
  10.  
  11. <div class="review-box">
  12.     <h3 class="subheading"><?php _e('The Review', 'jeg_textdomain'); ?></h3>
  13.     <h2 class="post-title" itemprop="itemReviewed" itemscope itemtype="http://schema.org/Thing">
  14.         <span itemprop="name">
  15.             <?php echo vp_metabox('jmagz_review_meta.product_name'); ?>
  16.         </span>
  17.     </h2>
  18.  
  19.     <?php if(intval($mean) > 0) :  ?>
  20.     <div class="clearfix" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
  21.         <meta itemprop="worstRating" content="1">
  22.         <meta itemprop="ratingValue" content="<?php echo esc_attr( $mean ); ?>">
  23.         <meta itemprop="bestRating" content="10">
  24.         <div class="rating-score score-<?php echo esc_attr(jeg_get_score_name($mean)); ?>">
  25.             <strong class="score-value"><?php echo esc_html( $mean ); ?></strong>
  26.             <span class="score-desc"><?php _e('Score', 'jeg_textdomain') ?></span>
  27.         </div>
  28.         <div class="review-shortdesc">
  29.             <p itemprop="description">"<?php echo vp_metabox('jmagz_review_meta.product_summary'); ?>"</p>
  30.         </div>
  31.     </div>
  32.     <?php endif;  ?>
  33.  
  34.     <?php
  35.         $pricewidgetlocation = vp_option('joption.show_price_widget', 'none');
  36.         $pricelist = vp_metabox('jmagz_review_price.price');
  37.  
  38.         if(!empty($pricelist)) {
  39.             if($pricewidgetlocation == 'reviewbox' || $pricewidgetlocation == 'both') {
  40.                 $pricehtml = '';
  41.                 foreach($pricelist as $pricestore) {
  42.                     $price = vp_option('joption.review_price_front', '$') . $pricestore['price'] . vp_option('joption.review_price_behind');
  43.                     $pricehtml .=
  44.                         '<li>
  45.                            <strong class="store-name">' . $pricestore['shop'] . '</strong>
  46.                            <div class="store-aff">
  47.                                <a target="_blank" href="' . $pricestore['link'] . '" class="aff-price">' . $price . '</a>
  48.                                <a target="_blank" href="' . $pricestore['link'] . '" class="aff-link">' . __('Buy', 'jeg_textdomain') . '</a>
  49.                            </div>
  50.                        </li>';
  51.                 }
  52.                 $lowestprice = get_post_meta(get_the_ID(),'price_lowest');
  53.                 $lowestprice = vp_option('joption.review_price_front', '$') . $lowestprice[0] . vp_option('joption.review_price_behind');
  54.  
  55.                 $lowestpriceinfo = '';
  56.  
  57.                 if(sizeof($pricelist) > 1) {
  58.                     $lowestpriceinfo =
  59.                         '<div class="price-info">
  60.                        <h4 class="info-title">' . __('Lowest Price at:', 'jeg_textdomain') . '</h4>
  61.                        <strong>' . $lowestprice . '</strong>
  62.                    </div>';
  63.                 }
  64.  
  65.                 echo
  66.                     '<div class="productinfo clearfix">
  67.                        ' . $lowestpriceinfo . '
  68.                        <div class="store-info">
  69.                            <h4 class="info-title">' . __('Where to buy:', 'jeg_textdomain') . '</h4>
  70.                            <ul class="stores">
  71.                                ' . $pricehtml . '
  72.                            </ul>
  73.                        </div>
  74.                    </div>';
  75.             }
  76.         }
  77.     ?>
  78.  
  79.     <div class="review-goodbad row clearfix">
  80.         <?php
  81.             $goods = vp_metabox('jmagz_review_good_bad.good');
  82.             if($goods) {
  83.         ?>
  84.         <div class="col-md-6">
  85.  
  86.             <h3 class="subheading"><i class="fa fa-check"></i> <?php _e('The Good', 'jeg_textdomain'); ?></h3>
  87.             <ul class="fa-ul">
  88.                 <?php
  89.                     foreach($goods as $good) {
  90.                         echo '<li><i class="fa fa-li fa-circle"></i> ' . $good['good_text'] . '</li>';
  91.                     }
  92.                 ?>
  93.             </ul>
  94.         </div>
  95.         <?php
  96.             }
  97.             $bads = vp_metabox('jmagz_review_good_bad.bad');
  98.             if($bads) {
  99.         ?>
  100.         <div class="col-md-6">
  101.             <h3 class="subheading"><i class="fa fa-close"></i> <?php _e('The Bad', 'jeg_textdomain'); ?></h3>
  102.             <ul class="fa-ul">
  103.                 <?php
  104.                     foreach($bads as $bad) {
  105.                         echo '<li><i class="fa fa-li fa-circle"></i> ' . $bad['bad_text'] . '</li>';
  106.                     }
  107.                 ?>
  108.             </ul>
  109.         </div>
  110.         <?php
  111.             }
  112.         ?>
  113.     </div>
  114.     <?php if(intval($mean) > 0) :  ?>
  115.     <div class="review-scores review-bars clearfix">
  116.         <h3 class="subheading lined"><?php _e('Breakdown', 'jeg_textdomain'); ?></h3>
  117.         <ul>
  118.             <?php
  119.             $reviews = vp_metabox('jmagz_review_rating.rating');
  120.             foreach($reviews as $review) {
  121.                 $ratingvalue = $review['rating_number'] * 10;
  122.                 echo
  123.                 '<li>
  124.                    <em>' . $review['rating_text'] . '</em> <strong class="bar-score">' . $ratingvalue . '%</strong>
  125.                    <div class="bar-wrap">
  126.                        <span data-width="' . $ratingvalue . '" class="' . jeg_get_score_name($review['rating_number']) . '-bar bar-bg"></span>
  127.                    </div>
  128.                </li>';
  129.             }
  130.             ?>
  131.         </ul>
  132.     </div>
  133.     <?php endif; ?>
  134. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement