WordPress.org

Support

Support » Themes and Templates » P2 » [Resolved] Full width Page layout

[Resolved] Full width Page layout

  • Is there a way to get a single Page to be full width (no widget sidebar) but keep the widget sidebar on the homepage?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Kathryn

    @zoonini

    Hi there, in the P2 theme, the sidebar include is in the file header.php, on line 48. (Your line numbers may differ if you’ve made any changes to the theme.)

    To exclude the sidebar on static pages, you could try wrapping it in a conditional tag, so the sidebar only gets included if it’s NOT a page. So instead of this:

    <?php get_sidebar(); ?>

    You would have this:

    <?php if ( ! is_page() ):
    		get_sidebar();
          endif; ?>

    After you do that you’ll also need to make some CSS adjustments to the widths of various elements. You can start by adding this to your child theme:

    #main {
        width: 960px !important;
    }

    (If it works without !important you can remove it.)

    Just a heads-up that the best way to make changes to a theme is to use a child theme, so your tweaks won’t be overwritten when updating the theme. Here are some guides in case you haven’t made one before:

    http://codex.wordpress.org/Child_Themes
    http://op111.net/53/
    http://vimeo.com/49770088

    Let me know how it goes.

    I ended up putting this at the top of my Page and it worked:

    <style>
    #sidebar {width:0;height:0}
    #main {width:950px}
    </style>

    Moderator Kathryn

    @zoonini

    Glad you found something that worked.

    A more standard way to hide an element with CSS is:

    #sidebar {
       display: none;
    }
    Moderator Kathryn

    @zoonini

    Just a heads-up that adding styles outside of the head area of a web page isn’t recommended. You can put this in a child theme (or CSS plugin) to target the sidebar and main elements only on pages:

    .page #sidebar {
       display: none;
    }
    .page #main {
       width: 950px
    }

    Fantastic Kathryn! Thanks.

    Moderator Kathryn

    @zoonini

    wpfranner – glad that helped!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] Full width Page layout’ is closed to new replies.
Skip to toolbar