我想首先按日期订购帖子,然后按观看次数
订购帖子新更新:
$trending_songs = new WP_Query(array(
'post_type' => 'songs',
'showposts' => $songs_count,
'cat' => 'songs_cat-689',
'orderby' => 'meta_value_num',
'meta_query' => array(
array(
'orderby' => 'date',
'order' => 'DESC',
),array(
'key' => 'views',
'order' => 'DESC',
)
),
));
日期不在帖子中(他们只是按views
订购)
答案 0 :(得分:1)
你可以使用类似下面代码的东西(这只是你需要根据你的要求改变的样本)
<?php
$args = array(
'post_type' => 'words',
'meta_query' => array(
array(
'key' => 'word_count',
'orderby' => 'date',
'order' => DESC
,
),
array(
'key' => 'title',
'orderby' => 'date',
'order' => DESC
),
array(
'key' => 'word_type',
'orderby' => 'date',
'order' => DESC
),
),
);
$query = new WP_Query( $args );
?>