Support » Themes and Templates » full width display on SOME pages in twenty twelve

  • I’ve been working on a child theme of twenty twelve.

    I want to have sidebars on SOME of my pages (turns out, they are “pages”), and twenty twelve gives me very convenient options for layout on a per page basis.

    I want some OTHER pages to be full width, no sidebars. Sadly, these are NOT “pages”–I want this for my single post pages and for my category archives. The category archives are most of what is listed in the top level menus, and a primary piece of presentation and navigation.

    It is very easy to remove the get_sidebar() line from category.php (yes, I am working on the child theme). BUT the page content stays huddled over on the left-hand two-thirds of the page–NOT what I was after. (The custom post formats do not affect the width here at all.)

    Yes, I can remove all widgets from the sidebar and then ALL pages turn out single-column, but I actually WANT a side bar on certain pages (that are “pages”).

    I can usually bumble around with the php and do what I need, but I am stumped, not even sure where the width of the sidebar-less category pages is being controlled.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael

    (@alchymyth)

    Forum Moderator

    to get a full width content in category archive pages without sidebar, add in your child theme’s functions.php something like:

    add_filter('body_class','twentytwelvechild_body_classes',20);
    function twentytwelvechild_body_classes( $classes ) {
    
    	if ( is_category() )
    		$classes[] = 'full-width';
    
    	return $classes;
    }

    Thanks, that works like a charm!

    Have been trying to do the same thing for my individual posts by substituting is_single (and myriad similar phrases) for is_category, with no luck, however.

    Michael

    (@alchymyth)

    Forum Moderator

    Have been trying to do the same thing for my individual posts by substituting is_single (and myriad similar phrases) for is_category, with no luck, however.

    should work – remove the sidebar call from single.php, and change this in the ‘category fix’ function:

    if ( is_category() || is_single() )
    		$classes[] = 'full-width';

    only the large featured image will not get stretched automatically; for that you would possibly need to introduce a new image size, and call that in single posts (?) http://codex.wordpress.org/Post_Thumbnails

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘full width display on SOME pages in twenty twelve’ is closed to new replies.