SO网友:Behzad G.
您只需获取当前日期并将其添加到wp\\U query中的data\\U query中,如下所示:
<?php
$getdate = getdate();
$args = array(
\'date_query\' => array(
array(
\'year\' => $getdate["year"]
),
),
);
$query = new WP_Query( $args );
?>
然后使用循环:
<?php
if ( $query->have_posts() ): while ( $query->have_posts() ) : $query->the_post();
the_title();
the_content();
endwhile; endif;
?>