ReviewPress ループで効かない件 とその他改造

400行目くらいから class-shortcode.php

id raty_rich だからループでおかしくなってたので
クラスにかえ、更に、
記事IDを入れたクラスを付け そこに 星を入れる設定にした。

		$query = new WP_Query( $query_args );

		$total_rating = 0;
		if ( $query->have_posts() ) :
			while ( $query->have_posts() ) : $query->the_post();

			$total_rating += intval( get_post_meta( $post->ID ,'wpbr_review_rating',true ) );
			$parent_title = get_the_title( wp_get_post_parent_id( $post->ID ) );
		
		//tuiki 
		$d_id = $post->ID;

		endwhile;
	
		$rich_rating = "<div class='raty_rich raty_rich".$d_id."' style='color:". review_get_option( 'rating_icon_color', 'wpbr_display' ) ."'></div>";

		if ( 'star' === review_get_option( 'review_icon', 'wpbr_display' ) ) {
			$rich_rating .= "<script>
			jQuery('.raty_rich".$d_id."').raty({
				readOnly : true,
				cancel   : false,
				half     : true,
				score    : '".round( $total_rating / $query->post_count , 2 )."',
				starType : 'i',
				starHalf : 'wpbr-star-half',
				starOff  : 'wpbr-star-off',
				starOn   : 'wpbr-star-on',
			});
			</script>";
		} else {
			$rich_rating .= "<script>
			jQuery('.raty_rich').raty({
				readOnly : true,
				cancel   : false,
				half     : true,
				score    : '".round( $total_rating / $query->post_count , 2 )."',
				starType : 'i',
				starHalf : 'wpbr-heart-half',
				starOff  : 'wpbr-heart-off',
				starOn   : 'wpbr-heart-on',
			});
			</script>";
		}

		ob_start();
		
		?>


<!--シングル-->
	
	<?php if(is_single()):?>		
		<div itemscope itemtype="http://schema.org/Product" class="d_rate">
			<span itemprop="name" style="display:none"><?php echo esc_html( $parent_title ); ?></span>
			<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating" >
				<div class="d_rate2">5つ星のうち<span itemprop="ratingValue"><?php echo esc_html( round( $total_rating / $query->post_count , 2 ) ); ?></span> </div>
<!--				based on-->
				<div class="link_color d_rate3" style="cursor: pointer"> <span itemprop="reviewCount"><?php echo esc_html( $query->post_count ); ?></span>件のレビュー</div>
				<div style="display:none">
					<span itemprop="bestRating">5</span>
					<span itemprop="worstRating">1</span>
				</div>
			</div>
		</div>
		
	<?php else:?>		
<!--ループ-->
				<div itemscope itemtype="http://schema.org/Product" class="d_rate" style="margin-left: -12px;">
			<span itemprop="name" style="display:none"><?php echo esc_html( $parent_title ); ?></span>
			<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating" >
				<div class="d_rate2">5つ星のうち<span itemprop="ratingValue"><?php echo esc_html( round( $total_rating / $query->post_count , 2 ) ); ?></span> </div>
<!--				based on-->
				<div class=" d_rate3">(<span itemprop="reviewCount"><?php echo esc_html( $query->post_count ); ?></span>件)</div>
				<div style="display:none">
					<span itemprop="bestRating">5</span>
					<span itemprop="worstRating">1</span>
				</div>
			</div>
		</div>
		
		<?php endif;?>

		<?php
		$rich_rating .= ob_get_clean();

		return $rich_rating;

	endif;
	wp_reset_postdata();

ベストセラー スティング

//welcartベストセラー サムネイル+順位表示が画像
add_filter('usces_filter_bestseller', 'my_bestseller_func', 10, 3);
function my_bestseller_func() {
    $args = func_get_args();
    list($html, $post_id, $index) = $args;
    $post = get_post($post_id);
    if ( $index == 0 ){
    $img = '/wp-content/themes/D/d/img/rank/1.png';
}    elseif ( $index == 1 ){
    $img = '/wp-content/themes/D/d/img/rank/2.png';
}    elseif ($index == 2){
    $img = '/wp-content/themes/D/d/img/rank/3.png';
}    else {
}
 $index = $index + 1;
	//usces_have_skus();
	global $usces;//計算始め
	$price = usces_the_firstPrice( 'return',$post );//売価
	$tax = $usces->getTax( $price );//売価×基本設定の税額(税計算方法も考慮します)
	$dprice = number_format($price + $tax);	
	$did = $post_id;
	$did2 = '[REVIEWPRESS_RICH_SNIPPET id="'.$did.'"]';
	$did3 = do_shortcode($did2);
	
    $list = '<a href="' . get_permalink($post_id) . '" class="top_new_item_box"><img src="' . $img . '" width="24" style="padding-bottom:6px; padding-right:6px;" /><span class="rank_num">'.$index.'.</span><div class="top_new_item_sam">
' . usces_the_itemImage(0, 300, 300, $post, 'return' ) . '</div><div class="top_item_name">' . $post->post_title . '</div>
      <div class="top_item_disp">¥'.$dprice.'</span><em class="tax">(税込)</em>
	  
	  		  <div>
	'.$did3.'
</div>
		 
</div>




</a>
';
	
    return $list;
}