Changeset 1355 for trunk/wp-includes/template-functions-general.php
- Timestamp:
- 05/24/2004 08:22:18 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-general.php
r1301 r1355 92 92 93 93 function wp_title($sep = '»', $display = true) { 94 global $wpdb , $tableposts, $tablecategories;94 global $wpdb; 95 95 global $year, $monthnum, $day, $cat, $p, $name, $month, $posts, $single; 96 96 … … 102 102 } 103 103 if (!empty($category_name)) { 104 $title = stripslashes($wpdb->get_var("SELECT cat_name FROM $ tablecategories WHERE category_nicename = '$category_name'"));104 $title = stripslashes($wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE category_nicename = '$category_name'")); 105 105 } 106 106 … … 137 137 138 138 function single_post_title($prefix = '', $display = true) { 139 global $p, $name, $wpdb , $tableposts;139 global $p, $name, $wpdb; 140 140 if (intval($p) || '' != $name) { 141 141 if (!$p) { 142 $p = $wpdb->get_var("SELECT ID FROM $ tableposts WHERE post_name = '$name'");142 $p = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$name'"); 143 143 } 144 144 $post_data = get_postdata($p); … … 203 203 204 204 function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { 205 global $tableposts;206 205 global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb; 207 206 … … 244 243 245 244 if ('monthly' == $type) { 246 $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);245 $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); 247 246 if ($arcresults) { 248 247 $afterafter = $after; … … 259 258 } 260 259 } elseif ('daily' == $type) { 261 $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);260 $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); 262 261 if ($arcresults) { 263 262 foreach ($arcresults as $arcresult) { … … 270 269 } elseif ('weekly' == $type) { 271 270 $start_of_week = get_settings('start_of_week'); 272 $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);271 $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); 273 272 $arc_w_last = ''; 274 273 if ($arcresults) { … … 289 288 } 290 289 } elseif ('postbypost' == $type) { 291 $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);290 $arcresults = $wpdb->get_results("SELECT ID, post_date, post_title FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 292 291 if ($arcresults) { 293 292 foreach ($arcresults as $arcresult) { … … 308 307 309 308 function get_calendar($daylength = 1) { 310 global $wpdb, $m, $monthnum, $year, $timedifference, $month, $month_abbrev, $weekday, $weekday_initial, $weekday_abbrev, $ tableposts, $posts;309 global $wpdb, $m, $monthnum, $year, $timedifference, $month, $month_abbrev, $weekday, $weekday_initial, $weekday_abbrev, $posts; 311 310 312 311 // Quick check. If we have no posts at all, abort! 313 312 if (!$posts) { 314 $gotsome = $wpdb->get_var("SELECT ID from $ tableposts WHERE post_status = 'publish' ORDER BY post_date DESC LIMIT 1");313 $gotsome = $wpdb->get_var("SELECT ID from $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date DESC LIMIT 1"); 315 314 if (!$gotsome) 316 315 return; … … 350 349 // Get the next and previous month and year with at least one post 351 350 $previous = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year 352 FROM $ tableposts351 FROM $wpdb->posts 353 352 WHERE post_date < '$thisyear-$thismonth-01' 354 353 AND post_status = 'publish' … … 356 355 LIMIT 1"); 357 356 $next = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year 358 FROM $ tableposts357 FROM $wpdb->posts 359 358 WHERE post_date > '$thisyear-$thismonth-01' 360 359 AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' ) … … 410 409 // Get days with posts 411 410 $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date) 412 FROM $ tableposts WHERE MONTH(post_date) = $thismonth411 FROM $wpdb->posts WHERE MONTH(post_date) = $thismonth 413 412 AND YEAR(post_date) = $thisyear 414 413 AND post_status = 'publish' … … 434 433 $ak_titles_for_day = array(); 435 434 $ak_post_titles = $wpdb->get_results("SELECT post_title, DAYOFMONTH(post_date) as dom " 436 ."FROM $ tableposts "435 ."FROM $wpdb->posts " 437 436 ."WHERE YEAR(post_date) = '$thisyear' " 438 437 ."AND MONTH(post_date) = '$thismonth' "
Note: See TracChangeset
for help on using the changeset viewer.