-1

enter image description here

Hello. I want to order the top rated results by post date + meta key so it only shows newest post + full rating/score

Here is my code

<div class="featbox">
<h3 class="sidetitl "> Top Rated Movies </h3>
<?php
$rate_query =  new WP_Query( array ( 'post_type' => 'movies', 'orderby' => 'date', 'meta_value', 'meta_key' => 'wtf_rscore', 'posts_per_page'=>'14' ) );
while ( $rate_query->have_posts() ) : $rate_query->the_post();
?>

Please help me, Thank you :)

0

Your syntax is off - I can see you're trying to add meta_value as an orderby param, but you've actually added as it an array entry - this is why formatting and indentation is important!

$rate_query = new WP_Query([
    'post_type'      => 'movies',
    'orderby'        => 'date meta_value_num',
    'meta_key'       => 'wtf_rscore', 
    'posts_per_page' => 14,
]);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.