Changeset 597 for trunk/b2-include/b2template.functions.php
- Timestamp:
- 12/10/2003 09:05:11 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/b2-include/b2template.functions.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/b2-include/b2template.functions.php
r595 r597 164 164 165 165 if ('monthly' == $type) { 166 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $tableposts WHERE post_date < '$now' AND post_ category > 0 AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit);166 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $tableposts WHERE post_date < '$now' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit); 167 167 if ($arcresults) { 168 168 foreach ($arcresults as $arcresult) { … … 178 178 } 179 179 } elseif ('daily' == $type) { 180 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $tableposts WHERE post_date < '$now' AND post_ category > 0 AND post_status = 'publish' ORDER BY post_date DESC" . $limit);180 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $tableposts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 181 181 if ($arcresults) { 182 182 foreach ($arcresults as $arcresult) { … … 191 191 $start_of_week = 1; 192 192 } 193 $arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd FROM $tableposts WHERE post_date < '$now' AND post_ category > 0 AND post_status = 'publish' ORDER BY post_date DESC" . $limit);193 $arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd FROM $tableposts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 194 194 $arc_w_last = ''; 195 195 if ($arcresults) { … … 210 210 } 211 211 } elseif ('postbypost' == $type) { 212 $arcresults = $wpdb->get_results("SELECT ID, post_date, post_title FROM $tableposts WHERE post_date < '$now' AND post_ category > 0 AND post_status = 'publish' ORDER BY post_date DESC" . $limit);212 $arcresults = $wpdb->get_results("SELECT ID, post_date, post_title FROM $tableposts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 213 213 if ($arcresults) { 214 214 foreach ($arcresults as $arcresult) { … … 233 233 // Quick check. If we have no posts at all, abort! 234 234 if (!$posts) { 235 $gotsome = $wpdb->get_var("SELECT ID from $tableposts WHERE post_status = 'publish' AND post_category > 0ORDER BY post_date DESC LIMIT 1");235 $gotsome = $wpdb->get_var("SELECT ID from $tableposts WHERE post_status = 'publish' ORDER BY post_date DESC LIMIT 1"); 236 236 if (!$gotsome) 237 237 return; … … 1048 1048 1049 1049 $limitprev--; 1050 $lastpost = @$wpdb->get_row("SELECT ID, post_title FROM $tableposts WHERE post_date < '$current_post_date' AND post_ category > 0 AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date DESC LIMIT $limitprev, 1");1050 $lastpost = @$wpdb->get_row("SELECT ID, post_title FROM $tableposts WHERE post_date < '$current_post_date' AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date DESC LIMIT $limitprev, 1"); 1051 1051 if ($lastpost) { 1052 1052 $string = '<a href="'.get_permalink($lastpost->ID).'">'.$previous; … … 1088 1088 $limitnext--; 1089 1089 1090 $nextpost = @$wpdb->get_row("SELECT ID,post_title FROM $tableposts WHERE post_date > '$current_post_date' AND post_date < '$now' AND post_ category > 0 AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date ASC LIMIT $limitnext,1");1090 $nextpost = @$wpdb->get_row("SELECT ID,post_title FROM $tableposts WHERE post_date > '$current_post_date' AND post_date < '$now' AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date ASC LIMIT $limitnext,1"); 1091 1091 if ($nextpost) { 1092 1092 $string = '<a href="'.get_permalink($nextpost->ID).'">'.$next;
Note: See TracChangeset
for help on using the changeset viewer.