我想得到离今天帖子最近的帖子;是的,我检查并搜索了此主题,发现代码适合我:
date_default_timezone_set("Europe/Warsaw");
setlocale(LC_ALL, en_GB);
$year = strftime(\'%Y\');
$month = strftime(\'%m\');
$day = strftime(\'%e\');
//$hour = strftime(\'%k\');
if($month < 10)
{
$month = substr($month,1);
}
$argsi = array(
\'numberposts\' => 1,
\'post_type\' => \'koncerty\',
\'orderby\' => \'date\',
\'order\' => \'ASC\',
\'date_query\' => array(
\'after\' => array(
\'year\' => $year,
\'month\' => $month
),
\'inclusive\' => \'true\'
)
);
$recent_post = wp_get_recent_posts($argsi, ARRAY_A);
问题是,当我想把一天的时间花在阵列上$argsi = array(
\'numberposts\' => 1,
\'post_type\' => \'koncerty\',
\'orderby\' => \'date\',
\'order\' => \'ASC\',
\'date_query\' => array(
\'after\' => array(
\'year\' => $year,
\'month\' => $month,
\'day\' => $day
),
\'inclusive\' => \'true\'
)
);
代码停止工作了,我不知道为什么。我试过了$day = strftime(\'%d\')
然后在其中删除0,如果天(<;10,但仍然没有:/