繁体   English   中英

用wordpress将值存储在数组中

[英]Storing values in an array with wordpress

因此,我正在尝试创建一个wordpress插件,该插件存储某个月撰写的帖子的所有日期。 因此,如果本月10日,12日和18日发布了帖子,我想将这些日期“ 10”,“ 12”和“ 18”存储在数组$stack[] 我是php的新手,所以我不知道为什么它不将日期存储在数组中:

// The Query
$themonth = date( 'n', current_time( 'timestamp' ) );
query_posts('cat=4&month=' . $themonth );
// The Loop
$stack = array();
while ( have_posts() ) : the_post(); 
$stack[] = the_time('j');
endwhile;

有任何想法吗?

将您的时间更改为:

while ( have_posts() ) : 
    the_post();
    $stack[the_time('j')] = get_the_content();
endwhile;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM