在wordpress中按月显示帖子类别

时间:2010-09-17 11:41:21

标签: wordpress sql-order-by categories

今天我解决了这个问题,如何按月显示帖子类别

如下面的url:

http://www.onlinescratchcards.me.uk/blog/

1 个答案:

答案 0 :(得分:0)

只需将其复制到您的php页面即可,

玩得开心!

脚本:

for($year1=$current_date;$year1>=2005;$year1--){ $arr_years[]=$year1; }

$tags = get_categories('orderby=id&exclude=1'); 

foreach ($tags as $tag) { 
$i=0; echo term_id) . '>
' . $tag->cat_name . '
';

foreach ((array) $arr_years as $years ) {

$posts2 = get_posts('category='. $tag->cat_ID . '&numberposts=400' . '&year=' . $years . 'orderby=date&order=asc' );

//----get years---- 
if($years!=null && $posts2 ){
foreach ((array) $mounts as $mon ) { 
$posts = get_posts('category='. $tag->cat_ID . '&numberposts=400' . '&monthnum=' . $mon . '&year=' . $years . '&order=asc' );

if($mon!=null && $posts){ 
echo ""; 
if($mon==1) echo " January";
if($mon==2) echo " February" ; 
if($mon==3) echo " March" ; 
if($mon==4) echo " April" ;    
if($mon==5) echo "May" ; 
if($mon==6) echo " June" ;      
if($mon==7) echo "July" ;

if($mon==8) echo " August" ;

if($mon==9) echo "September" ;

if($mon==10) echo " October" ;

if($mon==11) echo "November" ;

if($mon==12) echo "December" ; 
echo " " . $years . "" ;

foreach ($posts as $post ) {
?>
# " rel="bookmark" title="">

}//end foreach posts

}//the check posts

}//end foreach array 
}//end foreach for dates 
}//end (if date) 
}//begin first foreach 
echo "made Byy Roi Sabahhh !!! "; 
the_post();

// madeeee Byy Roi Sabahhh !!! ! 
// for comment and qustions you can send me email to: liroy1@gmail.com ?>

由于