Доброго времени суток.
В самом плагине есть такая функция
Display Lowest Rated Page/Post
### Function: Display Lowest Rated Page/Post
if(!function_exists('get_lowest_rated')) {
function get_lowest_rated($mode = '', $min_votes = 0, $limit = 10, $chars = 0, $display = true) {
global $wpdb;
$ratings_max = intval(get_option('postratings_max'));
$ratings_custom = intval(get_option('postratings_customrating'));
$output = '';
if(!empty($mode) && $mode != 'both') {
$where = $wpdb->prepare( "$wpdb->posts.post_type = %s", $mode );
} else {
$where = '1=1';
}
if($ratings_custom && $ratings_max == 2) {
$order_by = 'ratings_score';
} else {
$order_by = 'ratings_average';
}
$temp = stripslashes(get_option('postratings_template_highestrated'));
$sql = $wpdb->prepare(
"SELECT DISTINCT $wpdb->posts.ID, (t1.meta_value+0.00) AS ratings_average, (t2.meta_value+0.00) AS ratings_users, (t3.meta_value+0.00) AS ratings_score FROM $wpdb->posts LEFT JOIN $wpdb->postmeta AS t1 ON t1.post_id = $wpdb->posts.ID LEFT JOIN $wpdb->postmeta As t2 ON t1.post_id = t2.post_id LEFT JOIN $wpdb->postmeta AS t3 ON t3.post_id = $wpdb->posts.ID WHERE t1.meta_key = 'ratings_average' AND t2.meta_key = 'ratings_users' AND t3.meta_key = 'ratings_score' AND $wpdb->posts.post_password = '' AND $wpdb->posts.post_date < NOW() AND $wpdb->posts.post_status = 'publish' AND t2.meta_value >= %d AND $where ORDER BY $order_by ASC, ratings_users DESC LIMIT %d",
$min_votes,
$limit
);
if ( false === ( $lowest_rated = wp_cache_get( $cache_key = 'get_lowest_rated_' . md5($sql), $cache_group = 'wp-postratings' ) ) ) {
$lowest_rated = $wpdb->get_results( $sql, ARRAY_A );
wp_cache_add( $cache_key, $lowest_rated, $cache_group, HOUR_IN_SECONDS );
}
// Prime the post caches if need be.
_prime_post_caches( wp_list_pluck( $lowest_rated, 'ID' ) );
// Add the post objects
foreach ( $lowest_rated as $i => $post_rating ) {
$lowest_rated[ $i ] = (object) array_merge( $post_rating, (array)get_post( $post_rating['ID'] ) );
}
if($lowest_rated) {
foreach($lowest_rated as $post) {
$output .= expand_ratings_template($temp, $post, null, $chars, false)."\n";
}
} else {
$output = '<li>'.esc_html__('N/A', 'wp-postratings').'</li>'."\n";
}
if($display) {
echo $output;
} else {
return $output;
}
}
}
Код вывода
<?php if (function_exists('get_lowest_rated')): ?>
<ul>
<?php get_lowest_rated(post); ?>
</ul>
<?php endif; ?>
Но оная выводит посты в виде html, а как просто получить массив из ID постов?