Changeset 31979 for trunk/src/wp-includes/post-template.php
- Timestamp:
- 04/02/2015 01:04:22 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post-template.php
r31905 r31979 472 472 } 473 473 474 $term_class = sanitize_html_class( $term->slug, $term->term_id ); 475 if ( is_numeric( $term_class ) || ! trim( $term_class, '-' ) ) { 476 $term_class = $term->term_id; 477 } 478 474 479 // 'post_tag' uses the 'tag' prefix for backward compatibility. 475 480 if ( 'post_tag' == $taxonomy ) { 476 $classes[] = 'tag-' . sanitize_html_class( $term->slug, $term->term_id );481 $classes[] = 'tag-' . $term_class; 477 482 } else { 478 $classes[] = sanitize_html_class( $taxonomy . '-' . $term ->slug, $taxonomy . '-' . $term->term_id );483 $classes[] = sanitize_html_class( $taxonomy . '-' . $term_class, $taxonomy . '-' . $term->term_id ); 479 484 } 480 485 } … … 589 594 $classes[] = 'category'; 590 595 if ( isset( $cat->term_id ) ) { 591 $classes[] = 'category-' . sanitize_html_class( $cat->slug, $cat->term_id ); 596 $cat_class = sanitize_html_class( $cat->slug, $cat->term_id ); 597 if ( is_numeric( $cat_class ) || ! trim( $cat_class, '-' ) ) { 598 $cat_class = $cat->term_id; 599 } 600 601 $classes[] = 'category-' . $cat_class; 592 602 $classes[] = 'category-' . $cat->term_id; 593 603 } 594 604 } elseif ( is_tag() ) { 595 $tag s= $wp_query->get_queried_object();605 $tag = $wp_query->get_queried_object(); 596 606 $classes[] = 'tag'; 597 if ( isset( $tags->term_id ) ) { 598 $classes[] = 'tag-' . sanitize_html_class( $tags->slug, $tags->term_id ); 599 $classes[] = 'tag-' . $tags->term_id; 607 if ( isset( $tag->term_id ) ) { 608 $tag_class = sanitize_html_class( $tag->slug, $tag->term_id ); 609 if ( is_numeric( $tag_class ) || ! trim( $tag_class, '-' ) ) { 610 $tag_class = $tag->term_id; 611 } 612 613 $classes[] = 'tag-' . $tag_class; 614 $classes[] = 'tag-' . $tag->term_id; 600 615 } 601 616 } elseif ( is_tax() ) { 602 617 $term = $wp_query->get_queried_object(); 603 618 if ( isset( $term->term_id ) ) { 619 $term_class = sanitize_html_class( $term->slug, $term->term_id ); 620 if ( is_numeric( $term_class ) || ! trim( $term_class, '-' ) ) { 621 $term_class = $term->term_id; 622 } 623 604 624 $classes[] = 'tax-' . sanitize_html_class( $term->taxonomy ); 605 $classes[] = 'term-' . sanitize_html_class( $term->slug, $term->term_id );625 $classes[] = 'term-' . $term_class; 606 626 $classes[] = 'term-' . $term->term_id; 607 627 }
Note: See TracChangeset
for help on using the changeset viewer.