WordPress.org

Make WordPress Core

Ticket #15017: body_class_tax.trunk.diff

File body_class_tax.trunk.diff, 684 bytes (added by nkuttler, 10 years ago)
  • wp-includes/post-template.php

    diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php
    index d01b500..163d65d 100644
    a b function get_body_class( $class = '' ) { 
    422422                        $tags = $wp_query->get_queried_object();
    423423                        $classes[] = 'tag';
    424424                        $classes[] = 'tag-' . sanitize_html_class( $tags->slug, $tags->term_id );
     425                } elseif ( is_tax() ) {
     426                        $term = $wp_query->get_queried_object();
     427                        $classes[] = "tax-" . sanitize_html_class( $term->taxonomy, $term->term_taxonomy_id );
     428                        $classes[] = "term-" . sanitize_html_class( $term->slug, $term->term_id );
    425429                }
    426430        } elseif ( is_page() ) {
    427431                $classes[] = 'page';