WordPress.org

Make WordPress Core

Ticket #15017: body_class_tax2.2.diff

File body_class_tax2.2.diff, 656 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 e860716..bfe8f5b 100644
    a b function get_body_class( $class = '' ) { 
    421421                        $tags = $wp_query->get_queried_object();
    422422                        $classes[] = 'tag';
    423423                        $classes[] = 'tag-' . sanitize_html_class( $tags->slug, $tags->term_id );
     424                } elseif ( is_tax() ) {
     425                        $tax = $wp_query->get_queried_object();
     426                        $taxonomy = $tax->taxonomy;
     427                        $classes[] = "tax-$taxonomy";
     428                        $classes[] = "term-" . sanitize_html_class( $tax->slug, $tax->term_id );
    424429                }
    425430        } elseif ( is_page() ) {
    426431                $classes[] = 'page';