有条件声明检查帖子是否在2014
答
里面的WP循环就可以得到该职位的日期与内置的the_date(“Y”)的WP functino
所以在WP循环只需要检查,如果日期==像这样的东西。
<?php
if (have_posts()) {
while (have_posts()) {
if(the_date('Y') == '2015'):
the_post();
else:
continue;
endif;
} // end while
} // end if
?>