tag of the link and the ".after" Added before/after title and before/after title group parameters */ function showYearsAgo($showyears='3', $before = '', $after='', $showDate=true, $dateSeparator='/', $showTitle=false, $beforeTitleGroup='', $beforeTitle='
  • ', $afterTitle='
  • ') { global $wpdb, $tableposts; if (!isset($tableposts)) $tableposts = $wpdb->posts; $today = getdate(); $this_month = $today['mon']; $this_day = $today['mday']; $this_year = $today['year']; if ($this_month < 10) { $this_month = "0".$this_month; } if ($this_day < 10) { $this_day = "0".$this_day; } $info = get_bloginfo('url'); $info = apply_filters('bloginfo', $info); $homeurl = convert_chars($info); for ($i=1; $i <=$showyears; $i++) { //get a year ago $getyear = $this_year - $i; $getdate = $getyear."-".$this_month."-".$this_day; $forurl = $getyear.$this_month.$this_day; $forDisplay = $this_month.$dateSeparator.$this_day.$dateSeparator.$getyear; if ($i > 1) { $isPlural = 's'; } else { $isPlural = ''; } $past = $wpdb->get_results("SELECT * FROM $tableposts WHERE post_date LIKE '".$getdate." %'"); if ($past) { echo $before."This day ".$i." year".$isPlural." ago"; if ($showDate) { echo ": ".$forDisplay; } echo ""; if ($showTitle) { echo ":".$beforeTitleGroup; foreach ($past as $post) { $post_title = stripslashes ($post->post_title); echo $beforeTitle.$post_title.$afterTitle; } echo $afterTitleGroup; } echo $after; } } } function showWeeksAgo ($showweeks='1', $before = '', $after='', $showDate=true, $dateSeparator='/', $showTitle=false, $beforeTitleGroup='', $beforeTitle='
  • ', $afterTitle='
  • ') { global $wpdb, $tableposts; if (!isset($tableposts)) $tableposts = $wpdb->posts; $info = get_bloginfo('url'); $info = apply_filters('bloginfo', $info); $homeurl = convert_chars($info); // 3600 = 1 hour // 86400 = 1 day // 604800 = 1 week for ($i=1; $i <=$showweeks; $i++) { $numOfdaysAgo = 604800 * $i; $weeksAgoTimeStamp = time() - $numOfdaysAgo; $today = getdate($weeksAgoTimeStamp); $this_month = $today['mon']; $this_day = $today['mday']; $this_year = $today['year']; if ($this_month < 10) { $this_month = "0".$this_month; } if ($this_day < 10) { $this_day = "0".$this_day; } $getday = $this_day - $numOfWeeksAgo; $getdate = $this_year."-".$this_month."-".$this_day; $forurl = $this_year.$this_month.$this_day; $forDisplay = $this_month.$dateSeparator.$this_day.$dateSeparator.$this_year; if ($i > 1) { $isPlural = 's'; } else { $isPlural = ''; } $past = $wpdb->get_results("SELECT * FROM $tableposts WHERE post_date LIKE '".$getdate." %'"); if ($past) { echo $before."This day ".$i." week".$isPlural." ago"; if ($showDate) { echo ": ".$forDisplay; } echo ""; if ($showTitle) { echo ":".$beforeTitleGroup; foreach ($past as $post) { $post_title = stripslashes ($post->post_title); echo $beforeTitle.$post_title.$afterTitle; } echo $afterTitleGroup; } } } } function showMonthsAgo ($showmonths='1', $before = '', $after='', $showDate=true, $dateSeparator='/', $showTitle=false, $beforeTitleGroup='', $beforeTitle='
  • ', $afterTitle='
  • ') { global $wpdb, $tableposts; if (!isset($tableposts)) $tableposts = $wpdb->posts; $info = get_bloginfo('url'); $info = apply_filters('bloginfo', $info); $homeurl = convert_chars($info); $today = getdate(); $this_month = $today['mon']; $this_day = $today['mday']; $this_year = $today['year']; if ($this_day < 10) { $this_day = "0".$this_day; } $getyear = $this_year; for ($i=1; $i <=$showmonths; $i++) { $getmonth = $this_month - $i; if ($getmonth <= 0) { $getmonth = 12 + $getmonth; $getyear = $getyear - 1; } if ($getmonth < 10) { $getmonth = "0".$getmonth; } $getdate = $getyear."-".$getmonth."-".$this_day; $forurl = $getyear.$getmonth.$this_day; $forDisplay = $getmonth.$dateSeparator.$this_day.$dateSeparator.$getyear; if ($i > 1) { $isPlural = 's'; } else { $isPlural = ''; } $past = $wpdb->get_results("SELECT * FROM $tableposts WHERE post_date LIKE '".$getdate." %'"); if ($past) { echo $before."This day ".$i." month".$isPlural." ago"; if ($showDate) { echo ": ".$forDisplay; } echo ""; if ($showTitle) { echo ":".$beforeTitleGroup; foreach ($past as $post) { $post_title = stripslashes ($post->post_title); echo $beforeTitle.$post_title.$afterTitle; } echo $afterTitleGroup; } echo $after; } } } ?>