Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何显示特定月份每周的帖子?_Php_Wordpress - Fatal编程技术网

Php 如何显示特定月份每周的帖子?

Php 如何显示特定月份每周的帖子?,php,wordpress,Php,Wordpress,我必须显示如下帖子 2010年9月 2010年9月24日,星期五 2010年9月17日,星期五 2010年9月10日,星期五 2010年9月3日,星期五 有谁能告诉我,我该怎么做?或者我应该使用哪个函数 我已经使用了以下功能,我得到了本月的所有职位 query_posts("year=$current_year&monthnum=$current_month") 如何显示本月每周的帖子 这是工作查询吗?postsyear=$current\u year&monthnum=$curren

我必须显示如下帖子

2010年9月

2010年9月24日,星期五

2010年9月17日,星期五

2010年9月10日,星期五

2010年9月3日,星期五

有谁能告诉我,我该怎么做?或者我应该使用哪个函数

我已经使用了以下功能,我得到了本月的所有职位

query_posts("year=$current_year&monthnum=$current_month")
如何显示本月每周的帖子


这是工作查询吗?postsyear=$current\u year&monthnum=$current\u month&post\u date>$startDate&post\u date所以这实际上非常简单,每次周发生变化时,只需打印周标题。如果希望每周五都发生这种情况,只需在while语句的循环中使用类似的内容:

<?php
if(get_the_time("N")==5):
?>
<h1><?php the_time(); ?></h1>
<?php endif; ?>

您需要一些逻辑来确定第一篇帖子是否不是周五,并补偿差异。但我认为这很接近。

你可能想在wordpress.stackexchange.com上问这个问题。
post1
post2
.
.
.
post1
post2
.
.
.
query_posts("year=$current_year&monthnum=$current_month")
<?php
if(get_the_time("N")==5):
?>
<h1><?php the_time(); ?></h1>
<?php endif; ?>