This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Amazon rating form | |
*/ | |
?> | |
<div class="rating-form <?php echo $class; ?> amazon-rating-form"> | |
<?php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Overrides templates with custom templates when needed | |
* | |
* @param unknown $templates | |
* @param unknown $slug | |
* @param unknown $name | |
* @return unknown | |
*/ | |
function my_mrp_get_template_part( $templates, $slug, $name ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Adds Article itemReviewed for aggreagateRatings schema.org microdata | |
* | |
* @param $microdata | |
* @param $post_id | |
* @return $microdata | |
*/ | |
function mrp_microdata_aggregate_rating_item_reviewed_article( $microdata, $post_id ) { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Adds itemprop=aggregateRating | |
* | |
* @param unknown $microdata | |
* @param unknown $post_id | |
* @return string | |
*/ | |
function mrp_microdata_aggregate_rating_attributes( $microdata, $post_id ) { | |
return 'itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( $result_type == MRP_Multi_Rating::SCORE_RESULT_TYPE || strpos( $class, 'mrp-filter' ) > 0 ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function() { | |
mrp_data_callbacks.push( function(index, data) { | |
data["hello"] = "world"; | |
return data; | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mrp_rating_approved_headers( $headers ) { | |
$headers[] = 'From: Test <[email protected]>'; | |
return $headers; | |
} | |
add_filter( 'mrp_rating_approved_headers', 'mrp_rating_approved_headers', 10); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Search results are rounded half up or half down e.g. an overall rating of 4.67 will show up in | |
* search results for 5 stars. | |
* | |
* @param unknown $where | |
* @param unknown $query | |
* @return string | |
*/ | |
function mrp_search_posts_where( $where, $query ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$filters_hash = MRP_Multi_Rating_API::get_filters_hash( array() ); // if you want to add any Multi Rating pro specific filters e.g. rating_item_ids | |
$rating_form = MRP_Utils::get_rating_form( $post_id ); | |
$query = 'SELECT SUM(adjusted_score_result) FROM ' . $wpdb->prefix | |
. MRP_Multi_Rating::RATING_RESULT_TBL_NAME . ' rr WHERE rr.post_id = ' . $post_id . | |
' AND rr.rating_form_id = ' . $rating_form_id . ' AND rr.filters_hash = "' . $filters_hash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Add the following JavaScript --> | |
<script> | |
jQuery(document).ready(function() { | |
jQuery(".mrp-read-more-comment").on("click", function(e) { | |
var btnId = e.currentTarget.id; // mrp-read-more-comment-X | |
var parts = btnId.split("-"); | |
var entryId = parts[4]; | |
jQuery("#mrp-comment-full-" + entryId).css( "display", "inline-block" ); | |
jQuery("#mrp-comment-trim-" + entryId).css( "display", "none" ); |