I want to sort by the average. I have already been able to calculate and display the average on the fly by doing the following in the loop:
<?php
$rating1 = get(‘customfield1’);
$rating2 = get(‘customfield2’);
$rating3 = get(‘customfield3’);
$rating4 = get(‘customfield4’);
$rating5 = get(‘customfield5’);
$totalRatings = $rating1+$rating2+$rating3+$rating4+$rating5;
$totalVotes = 5;
$average = $totalRatings / $totalVotes;
?>
My ultimate objective is to be able to sort posts based on the the average.