2012-12-06 23 views
0

我已經看過這個支持論壇,但無法找到即時通訊尋找如此道歉,如果我錯過了答案。WP-PostRatings - 隨機返回4或5星的帖子

我正在開發一個query_posts參數列表來返回一個評級爲4或更高的隨機自定義帖子類型。

我當前的代碼看起來像:

$query_args['post_type'] = 'recipes'; 
$query_args['post_status'] = 'publish'; 
$query_args['r_sortby'] = 'highest_rated'; 
$query_args['r_orderby'] = 'rand'; 
$query_args['posts_per_page'] = '1'; 
query_posts($query_args); 

這回收視率最高的食譜。我如何修改只返回一個隨機4/5星配方?

非常感謝。

http://wordpress.org/extend/plugins/wp-postratings/

回答

0

設法得到這個工作使用的人誰感興趣的以下內容:

$query_args['meta_query'] = array(
     array(
      'key' => 'ratings_average', 
      'compare' => 'IN', 
      'value' => array(4,5) // 4 or 5 star recipes 
     ) 
    ); 
    $query_args['post_type'] = 'recipes'; 
    $query_args['post_status'] = 'publish'; 
    $query_args['orderby'] = 'rand'; 
    $query_args['posts_per_page'] = '1'; 
    query_posts($query_args);