请注意,我现在已解决此问题。对于任何感兴趣的人,请在下面找到我的代码(我已将所有内容都包含在一个快捷码中,以便于将其添加到任何我想要的地方):
function archiveday() {
$x=1;
do {
$result = date(\'l jS F Y\',strtotime("-$x days"));
$year= date(\'Y\',strtotime("-$x days"));
$month= date(\'n\',strtotime("-$x days"));
$day= date(\'j\',strtotime("-$x days"));
$my_query2 = get_posts("post_status=publish&post_type=post&year=$year&monthnum=$month&day=$day");
if ($my_query2){
echo \'<a href="http://EXAMPLE.COM/\'.$year.\'/\'.$month.\'/\'.$day.\'/">\'.$result.\'</a> (\'. count($my_query2).\') <br>\'; }
else {
echo $result .\' (\'. count($my_query2).\') <br>\';}
$x++;}
while ($x<=10);
wp_reset_postdata();
}
add_shortcode(\'archive\', \'archiveday\');
现在输出以下内容: