WordPress.org

Ready to get started?Download WordPress

Forums

P2
[resolved] Full width Page layout (7 posts)

  1. anielsen
    Member
    Posted 7 months ago #

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

  2. 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.

  3. anielsen
    Member
    Posted 7 months ago #

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

    <style>
    #sidebar {width:0;height:0}
    #main {width:950px}
    </style>
  4. Glad you found something that worked.

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

    #sidebar {
       display: none;
    }
  5. 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
    }
  6. wpfranner
    Member
    Posted 4 months ago #

    Fantastic Kathryn! Thanks.

  7. wpfranner - glad that helped!

Reply

You must log in to post.

About this Theme

About this Topic