I would like to know what the average review score is for my courses? I have over 200 replies, they have given me stars. I want to easily know what their average score is so I can use it as PR.
add this code in your wplms-customizer.php file in wplms customizer plugin :
add_shortcode('all_review_average',function($atts,$content=null){ global $wpdb; return $wpdb->get_var("SELECT SUM(meta_value) FROM {$wpdb->postmeta} WHERE meta_key='average_rating'"); });
sorry for the wrong code , its the sum actually to have average :
add_shortcode('all_review_average',function($atts,$content=null){
global $wpdb;
return $wpdb->get_var("SELECT ROUND(AVG(meta_value),2) FROM {$wpdb->postmeta} WHERE meta_key='average_rating'");
});
Hi Alex,
I would like to know what the average review score is for my courses? I have over 200 replies, they have given me stars. I want to easily know what their average score is so I can use it as PR.
Thanks for helping.
Gijs
hi this is your average rating of a course :
And is it possible to easily see what the average is of ALL COURSES combined?
use this shortcode : [all_review_average]
add this code in your wplms-customizer.php file in wplms customizer plugin :
add_shortcode('all_review_average',function($atts,$content=null){
global $wpdb;
return $wpdb->get_var("SELECT SUM(meta_value) FROM {$wpdb->postmeta} WHERE meta_key='average_rating'");
});
When adding that code. This is the number I get when using the shortcode: 189.70000000000002
Is this correct? And how to interpret this?
sorry for the wrong code , its the sum actually to have average :
add_shortcode('all_review_average',function($atts,$content=null){ global $wpdb; return $wpdb->get_var("SELECT ROUND(AVG(meta_value),2) FROM {$wpdb->postmeta} WHERE meta_key='average_rating'"); });
worked! I have a 3.96. Thanks!