WordPress.org

Support

Support » Themes and Templates » [Resolved] How can i enable sidebars ONLY on home page?

[Resolved] How can i enable sidebars ONLY on home page?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Theme Author Frumph

    @frumph

    in the layout-head and layout-foot.php files you can put if statements for if (is_home()) in front of the loading of those sidebars then adjust the CSS for the widths of the narrowcolumn then make another one for body.home .narrowcolumn that has the original width in it

    I made the first part using if (is_page( array( 35, 12, 52, ‘Home’ ), but now I have to ajust the body not just in home page, how do i do that? Thank you for the help.

    Theme Author Frumph

    @frumph

    This is how you would write that in CSS (dependant on which layout you’re using):

    /* this will be full width set as default */
    .narrowcolumn {
         width: 970px;
    }
    
    /* then for each of the other pages that utilize the minor width */
    body.page-id-35 .narrowcolumn,
    body.page-id-12 .narrowcolumn,
    body.page-id-52 .narrowcolumn,
    body.home  .narrowcolumn {
         width: 560px;
    }

    See what I did there? basically setting the default for all pages as the wide width, then each of the ones that I want small width I used CSS (make sure it comes *after* the default in the css) I scrunched the width down.

    It works! Thank you very much 😀

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] How can i enable sidebars ONLY on home page?’ is closed to new replies.