2010-09-28 37 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; ?> 

你需要一些邏輯來確定的第一篇文章是不是週五,並賠償區別。但我認爲這非常接近。

相關問題