';
while ( $the_query->have_posts() ) {
$the_query->the_post();
$note = get_field('note', get_the_ID());
$noteHtml = '';
for($k=0; $k<$note; $k++){
$noteHtml .= '
';
}
for($m=$k; $m<5; $m++){
$noteHtml .= '
';
}
if($i == 0){
$html .= '
';
}elseif(!$i%2){
$html .= '
';
}
$avi = strip_tags(get_field('avis', get_the_ID()));
$avi = $avi!=''?'"'.strip_tags(get_field('avis', get_the_ID())).'"':'';
$html .= '
';
$i++;
$nbRating++;
$totalRatings += $note;
$jsonRatings .= '
{
"@type": "Review",
"author": {
"@type": "Person",
"name": "'.get_field('client', get_the_ID()).'"
},
"reviewBody": "'.strip_tags(get_field('avis', get_the_ID())).'",
"name": "'.get_the_title().'",
"reviewRating": {
"@type": "Rating",
"bestRating": "5",
"ratingValue": "'.$note.'",
"worstRating": "1"
}
},';
}
if(!$i%2){
$html = substr($html, 0, -109);
}else{
$html .= '
';
}
$html .= '
';
wp_reset_postdata();
}
echo $html;
if(strlen($jsonRatings)>0){
$jsonRatings = substr($jsonRatings, 0, -1);
}
?>