2017-05-19 41 views
1

我一個這樣的查詢後本年度郵政類型的WordPress

<?php 
    $args = (array(
    'post_type' => 'issue_number', 
    'posts_per_page' => 13, 
    'paged' => $paged 
        )); 

    // query 
    $the_query = new WP_Query($args); 

?> 


    <?php while($the_query->have_posts()) : $the_query->the_post();?> 

     bla bla 

    <?php endwhile; ?> 

我想只顯示當年交型(ISSUE_NUMBER)...怎麼辦?

回答

0

這應該這樣做。

$current_year = the_date('Y'); 

$args = array(
    'post_type' => 'issue_number', 
    'posts_per_page' => 13, 
    'paged' => $paged, 
    'year' => $current_year 
); 
+0

不......它不起作用! –

+0

解決! $ current_year = get_the_time('Y'); ... –