[Plugin: WP-PostRatings] WP_Query sorting by rating – not showing un-rated posts
-
Hi All.
I’m sorting a set of posts via WP_Query, by their rating.
<? $args = array( 'r_sortby' = 'highest_rated'; 'r_orderby' = 'desc'; ); $newquery = new WP_Query( $args); ?> <?php while ( $newquery->have_posts() ) : $newquery->the_post(); ?> <?php the_title(); ?> <?php if(function_exists('the_ratings')) { the_ratings(); } ?> <?php the_excerpt(); ?> <?php endwhile; wp_reset_query(); ?>
This correctly shows posts rated highest to lowest… however it omits any unrated posts.
What I need it to do, is for any unrated posts to show up at the end.
Turning on WP_DEBUG shows that lines 1088-1092 in wp-postrating.php (in the plugin folder) aren’t quite working.
The offending code
if(is_null($post_ratings_data)) { $post_ratings_data = get_post_custom($post_id); $post_ratings_users = intval($post_ratings_data['ratings_users'][0]); $post_ratings_score = intval($post_ratings_data['ratings_score'][0]); $post_ratings_average = floatval($post_ratings_data['ratings_average'][0]); }
Does anyone have any suggestions on how to either modifiy my code, to make it work.. or how to modify the plugin’s code to make it work
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘[Plugin: WP-PostRatings] WP_Query sorting by rating – not showing un-rated posts’ is closed to new replies.