Skip to content

Instantly share code, notes, and snippets.

@inetbiz
Last active August 23, 2016 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inetbiz/a9027b8653825594aab6304ca5c8eae3 to your computer and use it in GitHub Desktop.
Save inetbiz/a9027b8653825594aab6304ca5c8eae3 to your computer and use it in GitHub Desktop.
Sama Author Review WordPress Plugin Bug Fix
<?php
/**
* From Denver Prophit Jr.: This file fixes /wp-content/plugins/sama-author-review/templates/star-author-only.php
* The Template for displaying Author Review Star in single post.
* Override this template by copying it to yourtheme/sama-author-review/star.php
*
* @author samathemes inetbiz
* @package sama-author-review/templates
* @since 1.7
*/
$classes = 'author-review-box author-only';
$classes .= ' review-'. $author_review['position'];
$classes .= ' '. $author_review['type'];
?>
<div class="<?php echo $classes; ?>">
<?php do_action('before_author_review_box'); ?>
<div class="inner-review" itemscope itemtype="https://schema.org/Review">
<!-- hide this information used in schema don't touch this hidden fields-->
<span class="hidden" itemprop="itemreviewed"><?php the_title(); ?></span>
<span class="hidden" itemprop="author name"><?php the_author(); ?></span>
<time class="hidden updated" itemprop="dateCreated" datetime="<?php the_date('c'); ?>"><?php echo get_the_date('F j Y'); ?></time>
<?php
if ( get_the_author_meta( 'author_gplus') != '' ) {
$google_url = get_the_author_meta( 'author_gplus');
?>
<a class="hidden" id="Denver" itemprop="author" rel="author" href="<?php echo esc_url($google_url); ?>?rel=author"><?php the_author(); ?></a>
<?php } ?>
<!-- end of hide -->
<div class="review-header">
<?php if( isset( $author_review['title'] ) && $author_review['title'] != '' ) { ?>
<h3 class="review-title"><?php echo $author_review['title']; ?></h3>
<?php } ?>
</div>
<?php if ( isset( $author_review['items_review'] ) && is_array( $author_review['items_review'] ) ) { ?>
<div class="author-reviews">
<?php foreach ( $author_review['items_review'] as $item ) { ?>
<div class="review-item">
<div class="details">
<h5><?php echo $item['label']; ?></h5>
</div>
<div class="star-review">
<span class="star-under" title="<?php printf( __('Rated %1$s out of 5', 'samareview'), sama_convert_percent_to_star( $item['value']) ); ?>">
<span class="star-over" style="width:<?php echo $item['value'] ; ?>%;"></span>
</span>
</div>
</div>
<?php } ?>
</div>
<?php
/*
* @hook used to add user rate
*/
//do_action('after_author_review_box');
?>
<div class="review-summary">
<div class="final-score" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
<meta itemprop="worstRating" content="1" />
<meta itemprop="bestRating" content="5" />
<h3 itemprop="ratingValue" title="<?php printf( __('Rated %1$s out of 5', 'samareview'), $total_review ); ?>"><?php echo round($total_review, 1); ?></h3>
<span><?php echo $author_review['text_under_total']; ?></span>
</div>
<div itemprop="reviewBody description" class="short-summary">
<p><strong><?php _e('Summary:', 'samareview'); ?></strong> <?php echo $author_review['description']; ?></p>
</div>
</div>
<?php } ?>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment