WordPress.org

Ready to get started?Download WordPress

Forums

full width display on SOME pages in twenty twelve (4 posts)

  1. marthaleeturner
    Member
    Posted 1 year ago #

    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.

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    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;
    }
  3. marthaleeturner
    Member
    Posted 1 year ago #

    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.

  4. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic