WordPress.org

Support

Support » Themes and Templates » Twenty Eleven Custom Template Issue

Twenty Eleven Custom Template Issue

  • Have you created a custom page template for Twenty Eleven?

    Did you copy an existing template and just changed the template name, yet it renders completely different and you don’t know why?

    The solution is you need to add that new template file to the Body Classes in the functions.php file.

    Open the functions.php file and go to the end, about line 583 to find :

    [please mark any posted code – http://codex.wordpress.org/Forum_Welcome#Posting_Code ]

    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 need to add your custom template file name after the side bar page so it looks like this:

    if ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) && ! is_page_template( 'YOURCUSTOMTEMPLATE-page.php' ) )
    		$classes[] = 'singular';

    I hope this is helpful, because the info CANNOT BE FOUND IN THE DOCUMENTATION FOR THE DEFAULT WORDPRESS THEME!!!

    This is the second time I’ve run across an issue related to the default theme that is not found in any documentation. WORDPRESS – update the documentation.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Twenty Eleven Custom Template Issue’ is closed to new replies.