2010-09-28 67 views
1

我必须为以下我如何显示特定月份每周的帖子?

九月显示帖子2010

周五2010年9月24日

post1 
post2 
. 
. 
. 

周五2010年9月17日

post1 
post2 
. 
. 
. 

周五2010年9月10日

post1 
post2 
. 
. 
. 

周五2010年9月3日

post1 
post2 
. 
. 
. 

任何一个可以告诉,如何才能做到这一点?或者我应该使用哪些功能?

我用下面的函数,我得到了在当月所有岗位

query_posts("year=$current_year&monthnum=$current_month") 

我该怎么让每周的职位本月的?

是它的工作query_posts(""year=$current_year&monthnum=$current_month&post_date >$startDate&post_date <=$endDate")

或什么是另一种好办法?

+0

您可能想要在wordpress.stackexchange.com上提问。 – CanSpice 2010-09-28 20:04:42

+0

感谢您的评论 – 2010-09-28 20:20:08

回答

0

所以这实际上很简单,你所需要做的就是在每周改变时打印周标题。如果你想做到这一点每个星期五,正好有这样的事情在循环while语句里面:

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

你需要一些逻辑来确定的第一篇文章是不是周五,并赔偿区别。但我认为这非常接近。

相关问题