WordPress.org

Make WordPress Core

Changeset 10877


Ignore:
Timestamp:
04/06/09 15:42:12 (5 years ago)
Author:
ryan
Message:

Don't trigger loop start in get_body_class(). Props Denis-de-Bernardy. fixes #9457

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post-template.php

    r10810 r10877  
    385385 
    386386    if ( is_single() ) { 
    387         the_post(); 
     387        $wp_query->post = $wp_query->posts[0]; 
     388        setup_postdata($wp_query->post); 
    388389 
    389390        $postID = $wp_query->post->ID; 
     
    395396            $classes[] = 'attachmentid-' . $postID . ' attachment-' . str_replace( $mime_prefix, "", "$mime_type" ); 
    396397        } 
    397  
    398         rewind_posts(); 
    399398    } elseif ( is_archive() ) { 
    400399        if ( is_author() ) { 
     
    412411        } 
    413412    } elseif ( is_page() ) { 
    414         the_post(); 
    415  
     413        $wp_query->post = $wp_query->posts[0]; 
     414        setup_postdata($wp_query->post); 
     415         
    416416        $pageID = $wp_query->post->ID; 
    417417        $page_children = wp_list_pages("child_of=$pageID&echo=0"); 
     
    425425        if ( is_page_template() ) 
    426426            $classes[] = 'page-template page-template-' . str_replace( '.php', '-php', get_post_meta( $pageID, '_wp_page_template', true ) ); 
    427  
    428         rewind_posts(); 
    429427    } elseif ( is_search() ) { 
    430         the_post(); 
    431  
    432         if ( have_posts() ) 
     428        if ( !empty($wp_query->posts) ) 
    433429            $classes[] = 'search-results'; 
    434430        else 
    435431            $classes[] = 'search-no-results'; 
    436  
    437         rewind_posts(); 
    438432    } 
    439433 
Note: See TracChangeset for help on using the changeset viewer.