Only add one body class when multiple post types manage to be present for a post type archive due to pre_get_posts manipulation.

fixes #25341.

Built from https://develop.svn.wordpress.org/trunk@25745


git-svn-id: http://core.svn.wordpress.org/trunk@25658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-10-09 19:14:09 +00:00
parent f0eb99952c
commit 7b27a47e85
1 changed files with 4 additions and 2 deletions

View File

@ -458,8 +458,10 @@ function get_body_class( $class = '' ) {
} elseif ( is_archive() ) { } elseif ( is_archive() ) {
if ( is_post_type_archive() ) { if ( is_post_type_archive() ) {
$classes[] = 'post-type-archive'; $classes[] = 'post-type-archive';
foreach ( (array) get_query_var( 'post_type' ) as $post_type ) $post_type = get_query_var( 'post_type' );
$classes[] = 'post-type-archive-' . sanitize_html_class( $post_type ); if ( is_array( $post_type ) )
$post_type = reset( $post_type );
$classes[] = 'post-type-archive-' . sanitize_html_class( $post_type );
} else if ( is_author() ) { } else if ( is_author() ) {
$author = $wp_query->get_queried_object(); $author = $wp_query->get_queried_object();
$classes[] = 'author'; $classes[] = 'author';