get_day_link() 在 wordpress 中无法准确工作



这是我的代码

这段代码在我的循环中

<a href="<?php echo get_day_link( get_the_time('Y'), get_the_time('m'), get_the_time('d')); ?>"><?php echo get_the_date(); ?></a>

它显示"哎呀!找不到该页面。

但是如果我这样写(我的意思是(年、月、日(变量出圈(

<?php
     $archive_year  = get_the_time( 'Y' ); 
     $archive_month = get_the_time( 'm' ); 
     $archive_day   = get_the_time( 'd' ); 
<?
<?php if( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
   <a href="<?php echo esc_url( get_day_link( $archive_year, $archive_month, $archive_day ) ); ?>">
      <?php _e( 'This day’s posts', 'textdomain' ); ?>
   </a>
<?php endwhile; endif;?>

它将我带到正确的页面,但有一个静态的日期 (19(,其中一天是 20。

注意:这是一个自定义帖子。 如果我只使用年份(2018(和月份(01(,它可以正常工作。

问题是白天。

尝试在循环中添加日期变量( 在 the_post(( 之后(。

最新更新