Changeset 22451
- Timestamp:
- 11/07/2012 10:12:44 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-template.php
r22118 r22451 430 430 431 431 $classes[] = 'single'; 432 $classes[] = 'single-' . sanitize_html_class($post->post_type, $post_id); 433 $classes[] = 'postid-' . $post_id; 434 435 // Post Format 436 if ( post_type_supports( $post->post_type, 'post-formats' ) ) { 437 $post_format = get_post_format( $post->ID ); 438 439 if ( $post_format && !is_wp_error($post_format) ) 440 $classes[] = 'single-format-' . sanitize_html_class( $post_format ); 441 else 442 $classes[] = 'single-format-standard'; 432 if ( isset( $post->post_type ) ) { 433 $classes[] = 'single-' . sanitize_html_class($post->post_type, $post_id); 434 $classes[] = 'postid-' . $post_id; 435 436 // Post Format 437 if ( post_type_supports( $post->post_type, 'post-formats' ) ) { 438 $post_format = get_post_format( $post->ID ); 439 440 if ( $post_format && !is_wp_error($post_format) ) 441 $classes[] = 'single-format-' . sanitize_html_class( $post_format ); 442 else 443 $classes[] = 'single-format-standard'; 444 } 443 445 } 444 446 … … 456 458 $author = $wp_query->get_queried_object(); 457 459 $classes[] = 'author'; 458 $classes[] = 'author-' . sanitize_html_class( $author->user_nicename , $author->ID ); 459 $classes[] = 'author-' . $author->ID; 460 if ( isset( $author->user_nicename ) ) { 461 $classes[] = 'author-' . sanitize_html_class( $author->user_nicename, $author->ID ); 462 $classes[] = 'author-' . $author->ID; 463 } 460 464 } elseif ( is_category() ) { 461 465 $cat = $wp_query->get_queried_object(); 462 466 $classes[] = 'category'; 463 $classes[] = 'category-' . sanitize_html_class( $cat->slug, $cat->term_id ); 464 $classes[] = 'category-' . $cat->term_id; 467 if ( isset( $cat->term_id ) ) { 468 $classes[] = 'category-' . sanitize_html_class( $cat->slug, $cat->term_id ); 469 $classes[] = 'category-' . $cat->term_id; 470 } 465 471 } elseif ( is_tag() ) { 466 472 $tags = $wp_query->get_queried_object(); 467 473 $classes[] = 'tag'; 468 $classes[] = 'tag-' . sanitize_html_class( $tags->slug, $tags->term_id ); 469 $classes[] = 'tag-' . $tags->term_id; 474 if ( isset( $tags->term_id ) ) { 475 $classes[] = 'tag-' . sanitize_html_class( $tags->slug, $tags->term_id ); 476 $classes[] = 'tag-' . $tags->term_id; 477 } 470 478 } elseif ( is_tax() ) { 471 479 $term = $wp_query->get_queried_object(); 472 $classes[] = 'tax-' . sanitize_html_class( $term->taxonomy ); 473 $classes[] = 'term-' . sanitize_html_class( $term->slug, $term->term_id ); 474 $classes[] = 'term-' . $term->term_id; 480 if ( isset( $term->term_id ) ) { 481 $classes[] = 'tax-' . sanitize_html_class( $term->taxonomy ); 482 $classes[] = 'term-' . sanitize_html_class( $term->slug, $term->term_id ); 483 $classes[] = 'term-' . $term->term_id; 484 } 475 485 } 476 486 } elseif ( is_page() ) {
Note: See TracChangeset
for help on using the changeset viewer.