Support » Plugin: Yasr - Yet Another Stars Rating » List Posts, Order by Rating

  • jabbamonkey

    (@jabbamonkey)


    How do you list posts in order of rating? A similar plugin used a custom query (see below).

    <?php // ORDER BY LIKES
        $args  = array(
            'orderby' => 'meta_value',
            'order' => 'DESC',
            'meta_query' => array(
                'relation' => 'OR',
                 array(
                    'key' => 'Likes',
                    'compare' => 'NOT EXISTS',
                    'type' => 'numeric'
                 ),
                 array(
                    'key' => 'Likes',
                    'compare' => 'EXISTS',
                    'type' => 'numeric'
                 )
             )
        );
        $args = array_merge( $args , $wp_query->query );
        query_posts($args);
    ?>

    What is the query that we should use? Please let me know… Thanks.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘List Posts, Order by Rating’ is closed to new replies.