Changeset 2478 for trunk/wp-includes/template-functions-post.php
- Timestamp:
- 03/27/2005 08:45:01 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-post.php
r2435 r2478 27 27 28 28 function get_the_title($id = 0) { 29 global $post, $wpdb; 30 31 if ( 0 != $id ) { 32 $id_post = $wpdb->get_row("SELECT post_title, post_password FROM $wpdb->posts WHERE ID = $id"); 33 $title = $id_post->post_title; 34 if (!empty($id_post->post_password)) 35 $title = sprintf(__('Protected: %s'), $title); 36 } 37 else { 38 $title = $post->post_title; 39 if (!empty($post->post_password)) 40 $title = sprintf(__('Protected: %s'), $title); 41 } 29 $post = &get_post($id); 30 31 $title = $post->post_title; 32 if (!empty($post->post_password)) 33 $title = sprintf(__('Protected: %s'), $title); 34 42 35 return $title; 43 36 } 44 37 45 38 function get_the_guid( $id = 0 ) { 46 global $post, $wpdb; 47 $guid = $post->guid; 48 49 if ( 0 != $id ) 50 $guid = $wpdb->get_var("SELECT guid FROM $wpdb->posts WHERE ID = $id"); 51 $guid = apply_filters('get_the_guid', $guid); 52 return $guid; 39 $post = &get_post($id); 40 41 return apply_filters('get_the_guid', $post->guid); 53 42 } 54 43 55 44 function the_guid( $id = 0 ) { 56 echo get_the_guid( );45 echo get_the_guid($id); 57 46 } 58 47 … … 262 251 // 263 252 264 function get_pages($args = '') {253 function &get_pages($args = '') { 265 254 global $wpdb, $cache_pages; 266 255 … … 281 270 } 282 271 283 $dates = ",UNIX_TIMESTAMP(post_modified) AS time_modified";284 $dates .= ",UNIX_TIMESTAMP(post_date) AS time_created";285 286 272 $post_parent = ''; 287 273 if ($r['child_of']) { … … 289 275 } 290 276 291 $pages = $wpdb->get_results("SELECT " . 292 "ID, post_title, post_name, post_parent " . 293 "$dates " . 277 $pages = $wpdb->get_results("SELECT * " . 294 278 "FROM $wpdb->posts " . 295 279 "WHERE post_status = 'static' " . … … 298 282 "ORDER BY " . $r['sort_column'] . " " . $r['sort_order']); 299 283 300 // Update page cache. 301 if (count($pages)) { 302 foreach($pages as $page) { 303 $cache_pages[$page->ID] = $page; 304 } 305 } 284 // Update cache. 285 update_post_cache($pages); 306 286 307 287 if ( empty($pages) ) … … 320 300 321 301 // Query pages. 322 $pages = get_pages($args);302 $pages = & get_pages($args); 323 303 if ( $pages ) : 324 304 … … 339 319 if (! empty($r['show_date'])) { 340 320 if ('modified' == $r['show_date']) 341 $page_tree[$page->ID]['ts'] = $page-> time_modified;321 $page_tree[$page->ID]['ts'] = $page->post_modified; 342 322 else 343 $page_tree[$page->ID]['ts'] = $page-> time_created;323 $page_tree[$page->ID]['ts'] = $page->post_date; 344 324 } 345 325 … … 384 364 if(isset($args['date_format'])) 385 365 $format = $args['date_format']; 386 echo " " . gmdate($format,$cur_page['ts']);366 echo " " . mysql2date($format,$cur_page['ts']); 387 367 } 388 368 echo "\n";
Note: See TracChangeset
for help on using the changeset viewer.