• Resolved trickadee

    (@trickadee)


    Hi There,
    I’m using a child theme of Twenty Eleven.

    I want to be able to display a sidebar on some of my custom post type archives/ taxonomies but not on others. I can remove the get_sidebar- no problem. But the body class needs to change in order for the layout to display correctly.

    How can I have differnt body classes associated with different page templates?

Viewing 2 replies - 1 through 2 (of 2 total)
  • look into functions.php, how the parent theme adds the .singular class to the body_class for certain templates:

    function twentyeleven_body_classes( $classes ) {
    
    	if ( function_exists( 'is_multi_author' ) && ! is_multi_author() )
    		$classes[] = 'single-author';
    
    	if ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )
    		$classes[] = 'singular';
    
    	return $classes;
    }
    add_filter( 'body_class', 'twentyeleven_body_classes' );

    you should be able to replicate this for your child theme and the custom archive templates.

    Thread Starter trickadee

    (@trickadee)

    Thanks very much- this was what I needed. ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Twenty Eleven Change Body Class’ is closed to new replies.