Changeset 29528

Show
Ignore:
Timestamp:
01/18/08 14:47:39 (6 months ago)
Author:
wuerzblog
Message:

adding anniversary-mode

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • a-year-before/trunk/ayb_posts.php

    r29527 r29528  
    5757      $notfound=__("No articles on this date.",$ayb_posts_domain); 
    5858      $range=0; 
     59      $anniv=0; 
    5960      $ayb_parameter = explode('&', $ayb_para); 
    6061      $i = 0; 
     
    103104      $range_date1=date("Y-m-d H:i",strtotime($ayb_tz,mktime(0, 0, 0, date("m")-$dmonth, date("d")-$dday, date("Y")-$dyear))); 
    104105      $range_date2=date("Y-m-d H:i",strtotime($ayb_tz,mktime(23,59,59, date("m")-$dmonth, date("d")-$dday+$range, date("Y")-$dyear))); 
    105       $month_day=substr($range_date1,4,7); 
    106  
    107       //$q="SELECT ID, post_title, post_date FROM $wpdb->posts WHERE post_status='publish' AND post_password='' AND (post_date >= '".$range_date1."' AND post_date <= '".$range_date2."') ORDER BY post_date DESC";      
    108       $q="SELECT ID, post_title, post_date FROM $wpdb->posts WHERE post_status='publish' AND post_password='' AND (post_date LIKE '%".$month_day."%') ORDER BY post_date DESC";      
     106      $month_day=substr($range_date2,4,7); 
     107 
     108       
     109  if($anniv==0) { 
     110  $q="SELECT ID, post_title, post_date FROM $wpdb->posts WHERE post_status='publish' AND post_password='' AND (post_date >= '".$range_date1."' AND post_date <= '".$range_date2."') ORDER BY post_date DESC";      
     111  } else { 
     112      $q="SELECT ID, post_title, post_date FROM $wpdb->posts WHERE post_status='publish' AND post_password='' AND post_date LIKE '%".$month_day."%' AND post_date<CURDATE() ORDER BY post_date DESC";   
     113      } 
    109114      $result = $wpdb->get_results($q, OBJECT); 
     115      /*echo "<!--\r$q\r//-->"; 
     116       
     117      echo "\r<!--\r"; 
     118      print_r($result); 
     119      echo "\r//-->\r"; 
     120      */ 
    110121 
    111122      //Ausgabe für's Widget 
     
    132143                  $ts_post_date=mktime(0,0,0,substr($post_date,5,2),substr($post_date,8,2),substr($post_date,1,4)); 
    133144                  $pdate='<span class="ayb_date">'.date($dateformat,$ts_post_date)."</span> "; 
    134                   if ($ts_post_date !=$ts_date_old) { 
     145                  if ($ts_post_date !=$ts_date_old && $range!=0) { 
    135146                        break; 
    136147                        } else {