我正在尝试创建一个循环,显示从本月 15 日开始的所有帖子。
$current_year = date('Y');
$current_month = date('m');
query_posts( "cat=22&year=$current_year&monthnum=$current_month&order=ASC" );
这不起作用,因为它从当月 1 日开始发布帖子。谢谢!
PS 不是 15 日的帖子,而是每月 15 日开始的帖子。
The standard query interfaces don't support this. You'll need to fetch the posts for the month and filter them in your processing loop.
$current_year = date('Y');
$current_month = date('m');
query_posts( "cat=22&year=$current_year&monthnum=$current_month&order=ASC" );
...
if (have_posts()) {
while (have_posts()) {
the_post();
if ( intval(get_the_date('j')) >= 15 ) {
// display the post
}
}
} else {
// no posts found
}