Ticket #1368: template_functions_general_1.5.1.2_mp001_hookup.patch
| File template_functions_general_1.5.1.2_mp001_hookup.patch, 3.4 KB (added by pejve, 7 years ago) |
|---|
-
template-functions-general.php
old new 297 297 $now = current_time('mysql'); 298 298 299 299 if ('monthly' == $type) { 300 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit); 300 $join = apply_filters('posts_join', ''); 301 $where = apply_filters('posts_where', "WHERE post_date < '$now' AND post_status = 'publish'"); 302 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit); 301 303 if ($arcresults) { 302 304 $afterafter = $after; 303 305 foreach ($arcresults as $arcresult) { … … 312 314 } 313 315 } 314 316 } elseif ('daily' == $type) { 315 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 317 $join = apply_filters('posts_join', ''); 318 $where = apply_filters('posts_where', "WHERE post_date < '$now' AND post_status = 'publish'"); 319 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts $join $where ORDER BY post_date DESC" . $limit); 316 320 if ($arcresults) { 317 321 foreach ($arcresults as $arcresult) { 318 322 $url = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth); … … 323 327 } 324 328 } elseif ('weekly' == $type) { 325 329 $start_of_week = get_settings('start_of_week'); 326 $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 $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 330 $join = apply_filters('posts_join', ''); 331 $where = apply_filters('posts_where', "WHERE post_date < '$now' AND post_status = 'publish'"); 332 $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 $wpdb->posts $join $where ORDER BY post_date DESC" . $limit); 327 333 $arc_w_last = ''; 328 334 if ($arcresults) { 329 335 foreach ($arcresults as $arcresult) { … … 342 348 } 343 349 } 344 350 } elseif ('postbypost' == $type) { 345 $arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 351 $join = apply_filters('posts_join', ''); 352 $where = apply_filters('posts_where', "WHERE post_date < '$now' AND post_status = 'publish'"); 353 $arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts $join $where ORDER BY post_date DESC" . $limit); 346 354 if ($arcresults) { 347 355 foreach ($arcresults as $arcresult) { 348 356 if ($arcresult->post_date != '0000-00-00 00:00:00') {
