Use get_pages() instead of a raw SQL query in get_body_class().

fixes #28159.

git-svn-id: https://develop.svn.wordpress.org/trunk@28696 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2014-06-07 03:21:46 +00:00
parent 40a7bccdc1
commit 88e8720018

View File

@ -594,8 +594,9 @@ function get_body_class( $class = '' ) {
$classes[] = 'page-id-' . $page_id;
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", $page_id) ) )
if ( get_pages( array( 'parent' => $page_id, 'number' => 1 ) ) ) {
$classes[] = 'page-parent';
}
if ( $post->post_parent ) {
$classes[] = 'page-child';