[wp-trac] [WordPress Trac] #18554: Twenty Eleven body classes for singular does not check condition is_front_page()
WordPress Trac
wp-trac at lists.automattic.com
Thu Sep 1 00:40:03 UTC 2011
#18554: Twenty Eleven body classes for singular does not check condition
is_front_page()
----------------------------+------------------------------
Reporter: Gabriel Reguly | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version: 3.2.1
Severity: normal | Resolution:
Keywords: close |
----------------------------+------------------------------
Comment (by Gabriel Reguly):
Please notice that is_singular() also returns true for the
is_page_template() conditions (because they are pages) yet are checked for
at the function and not labeled as 'singular'.
{{{
if ( is_singular() && ! is_home() ! is_page_template(
'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )
$classes[] = 'singular';
}}}
So thanks for the explanation, but, sorry, I am still wondering if
is_home_page() should be added or not.
Maybe the theme developers could explain their intention.
I am fine with the current situation, I just have added a filter and
redirected it to my own version ;-)
{{{
// fix body class
function my_theme_body_classes( $classes ) {
remove_filter( 'body_class', 'twentyeleven_body_classes' );
// baseado em function twentyeleven_body_classes( $classes ) {
if ( ! is_multi_author() ) {
$classes[] = 'single-author';
}
if ( is_singular() && ! is_home() && ! is_front_page() && !
is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-
page.php' ) )
$classes[] = 'singular';
return $classes;
}
add_filter( 'body_class', 'my_theme_body_classes', 5 );
}}}
Just suggested the enhancement as someone else could benefit from it.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18554#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list