2012-06-05 125 views
0

我有我的網頁只顯示未來的日期,這正是我想要的,我一直在四處搜尋試圖找到一種方式來查詢:僅在今天的日期之前發佈的帖子。WordPress的query_posts顯示過去的日期

這是目前我的查詢:

<?php 
$args=array(
    'post_type' => 'artists', 
    'orderby' => 'ecpt_featured_month', 
    'order' => 'ASC', 
    'post_status' => 'future' 
); 

任何想法?如果有幫助,每個帖子都是藝術家,他們有一個特色的月份,帖子=月份。

感謝,

瑞安

回答

0

使用這一考慮 「ecpt_featured_month」 是一個自定義字段:

$args=array(
    'post_type' => 'artists', 
    'orderby' => 'meta_value', 
    'meta_key' => 'ecpt_featured_month' 
    'order' => 'ASC', 
    'post_status' => 'future' 
); 
$loop = new WP_Query($args); 
while ($loop->have_posts()) : $loop->the_post(); 
// write the general code to display the post's title and date 
endwhile; 
相關問題