Changeset 12877
- Timestamp:
- 01/27/2010 05:45:49 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-template.php
r12751 r12877 393 393 394 394 if ( is_single() ) { 395 $wp_query->post = $wp_query->posts[0]; 396 setup_postdata($wp_query->post); 397 398 $postID = $wp_query->post->ID; 395 $postID = $wp_query->get_queried_object_id(); 396 399 397 $classes[] = 'single postid-' . $postID; 400 398 401 399 if ( is_attachment() ) { 402 $mime_type = get_post_mime_type( );400 $mime_type = get_post_mime_type($postID); 403 401 $mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' ); 404 402 $classes[] = 'attachmentid-' . $postID; … … 422 420 $classes[] = 'page'; 423 421 424 $wp_query->post = $wp_query->posts[0]; 425 setup_postdata($wp_query->post); 426 427 $pageID = $wp_query->post->ID; 422 $pageID = $wp_query->get_queried_object_id(); 423 424 $post = get_page($pageID); 428 425 429 426 $classes[] = 'page-id-' . $pageID; 430 427 431 if ( $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' LIMIT 1", $pageID) ) )428 if ( $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status = 'publish' LIMIT 1", $pageID) ) ) 432 429 $classes[] = 'page-parent'; 433 430 434 if ( $ wp_query->post->post_parent ) {431 if ( $post->post_parent ) { 435 432 $classes[] = 'page-child'; 436 $classes[] = 'parent-pageid-' . $ wp_query->post->post_parent;433 $classes[] = 'parent-pageid-' . $post->post_parent; 437 434 } 438 435 if ( is_page_template() ) {
Note: See TracChangeset
for help on using the changeset viewer.