I am trying to display Popular Posts on my website, selected by a mixture of Views and Comment Count. Since views are always way more than Comments, I am multiplying the Comment Count by X, but it doesnt seem to work how I was hoping it would. The Query Result is just ordered by the Meta Value "Views". I assume this is because I would need to calculate the Sum of Views + Comment Count * X and then order by it... But I am not sure how to accomplish this with using only get_posts(). Can somebody point me in the correct direction? :)
This is my Code
$home_top_news = get_posts(
array(
'post_type' => array('post','reviews'),
'post_status' => 'publish',
'numberposts' => '15',
'meta_key' => 'views',
'orderby' => array(
'meta_value_num' => 'DESC',
'(comment_count * 10)' => 'DESC',
),
'date_query' => array(
array(
'after' => '12 days ago'
)
)
)
);