Make WordPress Core

Changeset 11053


Ignore:
Timestamp:
04/22/2009 05:45:20 PM (15 years ago)
Author:
ryan
Message:

Faster query to see if page has children

File:
1 edited

Legend:

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

    r11013 r11053  
    363363 */
    364364function get_body_class( $class = '' ) {
    365     global $wp_query, $current_user;
     365    global $wp_query, $wpdb, $current_user;
    366366
    367367    $classes = array();
     
    420420
    421421        $pageID = $wp_query->post->ID;
    422         $page_children = wp_list_pages("child_of=$pageID&echo=0");
    423 
    424         if ( $page_children )
     422        if ( $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' LIMIT 1", $pageID) ) )
    425423            $classes[] = 'page-parent';
    426424
Note: See TracChangeset for help on using the changeset viewer.