Changeset 10810 for trunk/wp-includes/post-template.php
- Timestamp:
- 03/18/2009 02:43:45 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/post-template.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-template.php
r10774 r10810 361 361 function get_body_class( $class = '' ) { 362 362 global $wp_query, $current_user; 363 363 364 364 $classes = array(); 365 365 366 366 if ( 'rtl' == get_bloginfo('text_direction') ) 367 367 $classes[] = 'rtl'; 368 368 369 369 if ( is_front_page() ) 370 370 $classes[] = 'home'; … … 383 383 if ( is_404() ) 384 384 $classes[] = 'error404'; 385 385 386 386 if ( is_single() ) { 387 387 the_post(); 388 388 389 389 $postID = $wp_query->post->ID; 390 390 $classes[] = 'single postid-' . $postID; 391 391 392 392 if ( is_attachment() ) { 393 393 $mime_type = get_post_mime_type(); … … 395 395 $classes[] = 'attachmentid-' . $postID . ' attachment-' . str_replace( $mime_prefix, "", "$mime_type" ); 396 396 } 397 397 398 398 rewind_posts(); 399 399 } elseif ( is_archive() ) { … … 413 413 } elseif ( is_page() ) { 414 414 the_post(); 415 415 416 416 $pageID = $wp_query->post->ID; 417 417 $page_children = wp_list_pages("child_of=$pageID&echo=0"); 418 418 419 419 if ( $page_children ) 420 420 $classes[] = 'page-parent'; 421 421 422 422 if ( $wp_query->post->post_parent ) 423 423 $classes[] = 'page-child parent-pageid-' . $wp_query->post->post_parent; 424 424 425 425 if ( is_page_template() ) 426 426 $classes[] = 'page-template page-template-' . str_replace( '.php', '-php', get_post_meta( $pageID, '_wp_page_template', true ) ); 427 427 428 428 rewind_posts(); 429 429 } elseif ( is_search() ) { 430 430 the_post(); 431 431 432 432 if ( have_posts() ) 433 433 $classes[] = 'search-results'; 434 434 else 435 435 $classes[] = 'search-no-results'; 436 436 437 437 rewind_posts(); 438 438 } 439 439 440 440 if ( is_user_logged_in() ) 441 441 $classes[] = 'logged-in'; 442 442 443 443 $page = $wp_query->get('page'); 444 444 445 445 if ( !$page || $page < 2) 446 446 $page = $wp_query->get('paged'); 447 447 448 448 if ( $page && $page > 1 ) { 449 449 $classes[] = 'paged-' . $page; 450 450 451 451 if ( is_single() ) 452 452 $classes[] = 'single-paged-' . $page; … … 464 464 $classes[] = 'search-paged-' . $page; 465 465 } 466 466 467 467 if ( !empty($class) ) { 468 468 if ( !is_array( $class ) ) … … 470 470 $classes = array_merge($classes, $class); 471 471 } 472 472 473 473 return apply_filters('body_class', $classes, $class); 474 474 } … … 855 855 */ 856 856 function walk_page_tree($pages, $depth, $current_page, $r) { 857 if ( empty($r['walker']) ) 857 if ( empty($r['walker']) ) 858 858 $walker = new Walker_Page; 859 859 else … … 926 926 927 927 $post_title = attribute_escape($_post->post_title); 928 928 929 929 if ( $text ) { 930 930 $link_text = attribute_escape($text); … … 935 935 if( trim($link_text) == '' ) 936 936 $link_text = $_post->post_title; 937 937 938 938 return apply_filters( 'wp_get_attachment_link', "<a href='$url' title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon, $text ); 939 939 }
Note: See TracChangeset
for help on using the changeset viewer.