【问题标题】:Wordpress store the_date() in a arrayWordpress 将 the_date() 存储在数组中
【发布时间】:2013-10-30 02:02:29
【问题描述】:

我在 foreach 循环中有这段代码:

<?php $current_date[] = the_date('F Y'); ?>

我想要做的是将所有日期收集到一个数组中

但是当我 print_r 我的数组时,什么都没有出现...我该如何解决这个问题?

【问题讨论】:

    标签: php arrays wordpress foreach


    【解决方案1】:

    the_date是回声,使用

    <?php $current_date[] = the_date('F Y', '','', false); ?>
    

    false 关闭回声。

    http://codex.wordpress.org/Function_Reference/the_date

    或者像 Pekka 所说的那样 get_the_date('F Y');

    【讨论】:

      猜你喜欢
      • 2018-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-28
      • 1970-01-01
      • 2015-12-23
      相关资源
      最近更新 更多