WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Twelve
[resolved] Get 'full-width' class on category template? (5 posts)

  1. kglo
    Member
    Posted 1 year ago #

    Howdy,

    I'm trying to get some of my categories to behave like full-width pages. Removing the sidebar still leaves the page with the default .site-content width of 65%, so there's just a gap where the sidebar would be.

    The .site-content width changes to 100% if the body class is "full-width" but the body class is set through functions that are somewhat beyond my understanding. Removing the sidebar is apparently not enough to change the body class to "full-width," and it looks like that requires inclusion of the template page "front-page.php"... is there a way to do that? Or some other way to change the body class within the category template page?

    I could create new classes and monkey it myself but it would be easier if I could just get it to use the existing "full-width" class... any ideas?

    Also, YES, I am using a child theme.

  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    It sounds like you may just need to change the CSS code for the category template without the sidebar? Can you post a link to the page you're trying to change?

  3. alchymyth
    Forum Moderator
    Posted 1 year ago #

    get some of my categories to behave like full-width pages

    in functions.php of the child theme, add something like:

    add_filter('body_class','twentytwelvechild_body_class_adapt',20);
    function twentytwelvechild_body_class_adapt( $classes ) {
    
    	if ( is_category( array('some-cat-1','some-cat-2','some-other-cat') ) )
    		$classes[] = 'full-width';
    
    	return $classes;
    }

    http://codex.wordpress.org/Function_Reference/body_class#Add_Classes_By_Filters
    http://codex.wordpress.org/Function_Reference/is_category

  4. kglo
    Member
    Posted 1 year ago #

    Yes! That worked perfectly; thank you.

  5. ctrvanessa
    Member
    Posted 1 year ago #

    It works... Thanks^_^

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic