Viewing 2 replies - 1 through 2 (of 2 total)
  • I desperately need this feature!

    George

    (@subscriptiongroup)

    Hi Leedham,

    I created a very simple shortcode to allow me to place the aggregate on any part of the page.

    It is pretty basic implementation that uses JavaScript to copy the HTML from the bottom of the page to wherever you place it.

    Not sure if this would work for you.

    <?php
    
    // Create and define the shortcode
    add_shortcode('reviews_aggregate_rating', 'reviews_aggregate_rating');
    
    /**
     * Creates a hidden span element and copies the aggregates next to it.
     * The span is unique and therefore the shortcode can easily placed on the same page multiple times.
     */
    function reviews_aggregate_rating() {
    	$ID = rand();
    	$string = <<<EOL
    <span id="rarp-$ID" style="display:none;"></span>
    <script type="text/javascript">
    jQuery(document).ready(function(){
        jQuery('.wpcr3_aggregateRating_reviewCount').clone().insertAfter(jQuery('#rarp-$ID'));
        jQuery('.wpcr3_aggregateRating_ratingValue').clone().insertAfter(jQuery('#rarp-$ID')).css("display","inline-block", 'important');
    });
    </script>
    EOL;
    
    	return $string;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add Aggregate Reviews’ is closed to new replies.