Genesis Tutorials

Tips, Tricks, and How-tos for the Genesis Theme Framework

  • The Genesis Developer’s HandbookVisual Hook Guide
  • code, settings & options oh my!Resources
    • Collection Of CodeSnippets
    • Under ConstructionGenesis Functions
    • Coming Soon…Utilizing Genesis SEO Options
  • Extend GenesisPlug-ins
    • Genesis Post Teasers
    • Genesis Favicon Uploader
  • Genesis Child ThemesThemes
  • What is genesistutorials.com?About
    • Genesis Tutorials Roadmap
You are here: Home / Theming / Genesis Structural Wraps & Creating a Full Width Genesis Child Theme

Theming, Tutorial

Genesis Structural Wraps & Creating a Full Width Genesis Child Theme

July 20, 2011 by Christopher

Facebook0
Google+0
Twitter0

A full width theme normally consist of the header, nav, content and footer areas that have backgrounds that span the across the entire window while the inner area with the actual content of each section stays centered on the page. This help creates a visual separation between each section and to some just ascetically pleasing.

To create this effect you usually have your main container to each section as well as a wrap inside to keep its contents centered. The main container is set to 100% width and the inner wrap to the width you’d like your site to be fixed at then centered with a #margin: 0 auto;.

The steps below will go over exactly how to create a full width genesis child theme using the sample child theme as a base.

Genesis Structural Wraps

Step: 1
The Genesis Theme Framework by genesis comes with a wrap class inside it’s header, nav, and footer. The content area with sidebar is also wrapped by a div with the id of content-sidebar-wrap. For you basic content sidebar theme these are all the structual wraps you would need, however if you are to use the content sidebar sidebar or sidebar content content or even content sidebar sidebar layouts you will find one the sidebars to be left out from a wrap with no way to keep it beside your content. In Genesis version 1.6 a new function was created to aid in fixing this issue.

Adding or removing wraps for that matter is as simple as an add theme support function by the name of genesis-structual-wraps. For the full width theme we will be adding a wrap div to the inner div. To do this simply copy the code below and add it to your child theme’s function.php.

add_theme_support( 'genesis-structural-wraps', array( 'header', 'nav', 'subnav', 'inner', 'footer-widgets', 'footer' ) );

this theme support function contains all the id’s of the divs you wish to add an extra div wrapping it’s content in an array. Genesis currently supports adding the wrap div to:

  • header
  • nav
  • subnav
  • inner
  • footer-widgets
  • footer

inner isn’t originally in the array and adding the add_theme_support() code above will add it.
NOTE: To remove wraps for div simply remove the name from the array.

The style changes

Step 2:
By default the sample child theme for  genesis  is boxed in a 960px #wrap that constrains all the elements inside to that width centering them on the page. Find #wrap in your sample child theme style.css around line 162.
Change:

#wrap {
	background-color: #fff;
	margin: 0 auto 10px;
	width: 960px;
}

to:

#wrap {
	background-color: #fff;
}

This will remove the contraint and allow our elements inside to span as far as we please.

Step 3:
Add styles for the wrap divs that is inside each our main div structures. This style will set each area to 960px width with the margin:0 auto; centering them on the page.

.wrap {
	margin: 0 auto;
	width: 960px;
}

NOTE: Can be more specific to each area by adding the id of each setion before .wrap for example:

#nav .wrap { width: 900px; }


Will set the nav to be shorter than the other areas.

Step 4:
Find each main structural div and remove its width. The width we set for .wrap will handle this. Search for #header, #nav, #subnav, #inner, #footer-widgets & #footer and remove the width set for each.

Step 5:
Create your master piece.

Free Genesis Child Theme Download:

About Christopher

Dabbler of anything web/tech/design/music. Independent web designer & developer.

Follow me on twitter @tweetsfromchris

Comments

  1. JC says

    July 29, 2011 at 5:52 am

    Quick question. I am placing the navigation in the header and when I go to remove the primary nav using this hook:

    // Remove the Primary Navigation
    remove_action( ‘genesis_after_header’, ‘genesis_do_nav’ );

    all the content is being shoved to the right. This also happens when trying to remove it on the back end.

    any ideas?

    • Christopher says

      July 29, 2011 at 1:07 pm

      Hm, I wasn’t able to reproduce this locally. Is there a live link somewhere I could check out? It’s most likely a CSS issue and a float that isn’t being cleared properly.

      • JC says

        July 29, 2011 at 7:01 pm

        false alarm – I just tried it and got it to work! thanks!

      • JC says

        July 29, 2011 at 7:19 pm

        actually, on the blog page

        http://kaizendev.pairserver.com/jcd-test-server/?page_id=7

        • Christopher says

          July 30, 2011 at 9:28 am

          Ah, yup, put a clear: both; on #inner and wahlah :).

  2. JC says

    August 2, 2011 at 8:50 am

    I’ve another question. how would one go about creating full-width sections similar to the way one might do it here: http://ntunemedia.com/#home_section ?

    It seems there should be a way with this one, but haven’t figured it out yet. it seems the #inner div is the only one we have to manipulate when creating a custom page. or is there way to create multiple full-width divs?

    thanks!

    ps. can you add the “subscribe to this blog” plugin so we can get an email/rss notification when a reply is here?

    • Christopher says

      August 2, 2011 at 1:19 pm

      Check out the visual hook guide ( https://genesistutorials.com/visual-hook-guide )and check the radio button “Markup” beside the page title. This will show you the main div structure in conjunction with the hooks.

      Depending on above or below the main content I would use one the hooks below to input your full width areas.

      genesis_after_header
      genesis_before_footer

      And thanks for the suggestion with the plugin! installing that now.

  3. Cor van Noorloos says

    August 24, 2011 at 11:13 pm

    Hi Christopher,

    First of all, I really enjoy the visual hook guide you’ve posted.

    Personally I prefer the use of CSS to create a full width Genesis child them, but I’ve used the function to simply remove them all (except from the main #wrap which isn’t AFAIK within this function)

    Do you perhaps know if a similar function is available for the Genesis widget-wraps as well?

    Best regards,

    Cor

    • Christopher says

      September 9, 2011 at 4:48 am

      This could be accomplished through filtering genesis_register_sidebar with genesis_register_sidebar_defaults. By default the value for 'before_widget' is:

      <div id="%1$s" class="widget %2$s"><div class="widget-wrap">

      You can filter this function and remove

      <div class="widget-wrap">

      . If you want I could whip some code up for you to copy and paste into your child themes function.php let me know. If you figure it out though make sure to drop back by and share how you went about it!

      • Cor van Noorloos says

        September 11, 2011 at 3:07 pm

        Hi Christopher, and thanks!

        Since more needed to be changed, I’ve decided to redo the Genesis sidebars instead, instead of adding a filter (meaning removing them, and adding a new one).
        If allowed, here’s a link to the (current) final result: http://klanten.24design.net/html5/

  4. John Van Schaik says

    September 6, 2011 at 7:22 am

    I have a project which requires a 520 px wide fixed theme. Can this be accomplished with the genesis framework?

    Regards,

    John Van Schaik

    • Christopher says

      September 9, 2011 at 4:41 am

      Definitely possible. Most would be just stylesheet changes but I may remove the sidebars at that width or just set the site to full width content. then again it really depends on what you will be doing with it. 520px sounds like embedding it into a Facebook tab; If so have done that several times and is 100% possible with the genesis framework. Good luck!

  5. Josh Sarz says

    September 9, 2011 at 4:30 am

    I have another question. I’m fairly new to this and I don’t know what I’m doing. I followed the steps above and was successful in doing it with the nav bar and footer, I just can’t get the header image to take up the entire header section, and not just the center.

    • Christopher says

      September 9, 2011 at 4:39 am

      If it is an image you may need a larger image to take up the space you want it to, or have it repeat. Check out if it is repeating or large enough first and play with that. If can’t get it working leave a link to the site and I’ll check it out.

  6. Josh Sarz says

    September 9, 2011 at 6:26 am

    Yeah I tried that. I can’t seem to make the top header go all the way across the screen. There must be something else in the css that’s not allowing it to. I dunno, I just knew about css two weeks ago. XD

    My site is http://www.sagoyism.com

    RIght now I just set the header as text and description because images make it look weird.

  7. Rob Witty says

    October 22, 2011 at 4:03 am

    Hi Christopher,

    Thanks for the article, I am having some trouble after removing the width tag.

    The content header and background is not centering. Any ideas on how I can fix this?

    Take a look; http://HomeBizCouple.com

    Thanks for any insights you can give!
    Rob

  8. Tim Squires says

    February 10, 2012 at 11:48 pm

    Hello, I am trying to set up a full width nav bar with content centered on this development site:
    http://www.timsquires.com/flight
    The closest I can get is having the nav bar going full width, but the content sits way off to the left. I think your tutorial is pointing me in the right direction, but I can’t figure out what I’m doing wrong – would be grateful for your help. Many thanks, Tim

    • Christopher says

      February 11, 2012 at 12:15 am

      Hi Tim,
      On line 54 of your css file you will find:

      #nav .wrap {
      width: 900px;
      }
      

      simply change it to:

      #nav .wrap {
      width: 900px;
      margin: 0 auto;
      }
      

      The margin: 0 auto; basically is taking the width of 900px and adding the same margin on the left and right to center it.

      Site is looking great by the way.

      • Tim Squires says

        February 11, 2012 at 2:58 am

        Thank you so much! I’ve really been stuck with that and I’m grateful for your help. Thanks also for your compliments regarding the site – also much appreciated. Many thanks, Tim

  9. Nicole Bateman says

    February 20, 2012 at 2:58 pm

    Thanks so much. this was just what I needed. I love people smarter than me to figure these things out. 🙂

  10. Sola says

    March 2, 2012 at 12:08 pm

    Thank you for the great post. I have been learning Genesis Framework and your toturials are very helpful. I am looking forward to your TBA theme.

  11. Donco says

    March 16, 2012 at 1:21 pm

    Christopher
    Thanks for such an easy to understand tutorial. Sometimes it takes a different approach to help on understand things that come easy to others. I find your writing easy to follow and interesting to read. Thanks for taking the time to be so informative to those who are not tech savvy and are trying to understand how to use wordpress and genesis with customization. I look forward to reading more of your tutorials and learning how to fully utilize the powerful genesis framework. Execellent Tutorial!!!

  12. April says

    May 2, 2012 at 9:49 pm

    Thanks so much for the tutorial! I am a little confused on step 3. Where exactly am I supposed to add that? I don’t have a .wrap under any of those sections. I did a search, and it only appears 4 times. (all by something to do with my footer and footer widgets) Am I just supposed to go into each section and add that whole code in that section? Sorry if that’s a dumb question. I am REALLY new to this

    • Christopher says

      May 2, 2012 at 9:59 pm

      April, you are very welcome.
      Each additional section will just be to further constrain the widths. If you are to inspect your site you will search that each the main sections of genesis have a wrap div inside. For example:

      <div id="header">
           <div class="wrap">
                ...
           </div>
      </div>
      
      <div id="nav">
           <div class="wrap">
                ...
           </div>
      </div>
      
      <div id="footer">
           <div class="wrap">
                ...
           </div>
      </div>
      

      adding the following CSS:

      .wrap {
          margin: 0 auto;
          width: 960px;
      }
      

      contrains the inside of each those sections to the set width, but allowing the outside container to span the full width.

      If there is a #footer .wrap { … } or the like for the other sections it should be fine to leave them. Only ones to be concerned of are if a width is set to #header { … }, #nav { … }, ect., without targeting its inner wrap class since that will constrain the entire width of the section.

      Let me know if this makes sense, if not I can create a little graphic when I have some free time to further explain.

  13. Scott Whittle says

    May 18, 2012 at 3:56 pm

    @Christopher, You Rock! I am a Genesis Newbie and this helped me so much. Simple once you understand it. Just working to wrap my mind around this framework. I am enjoying the new experience but people like you makes it so much more enjoyable. Thanks

  14. Carrie says

    July 5, 2012 at 11:06 am

    Hi Christopher,
    Is it possible through filters or hooks to move an element OUT of the main wrapper? Scenario: I’d like to apply a box-shadow to my main wrapper (960px wide), but would like my nav (full-width with no box shadow) to output before my header and outside the wrapper.

    I’ve repositioned my primary nav above the header but can’t figure out how to get it outside the main wrapper.

    Thanks for the breakdown in the post – you’ve greatly increased my understanding of page elements and wrappers!

    • Carrie says

      July 5, 2012 at 1:46 pm

      Me again – nevermind! I went with using the _before hook to move the header. Thanks again! 🙂

  15. Jen says

    July 23, 2012 at 1:04 am

    Hey Christopher,

    I’m having trouble installing this into my css. I’m trying to have my navigation bar, footer widgets, and footer extend to the sides of the page. And now I’ve messed up the columns of my footer widgets, nothing is centered, and the bars are only extended on the left side. I’m new to wordpress and I feel like I’ve gone so far into changing things that it’s hard to go back. Can you take a look at it and tell me what’s messed up in my coding?
    http://www.queenofmanifestation.com

    Thanks so much. I really appreciate it!
    Jen

    • Christopher says

      August 18, 2012 at 1:28 pm

      You’re really close. Your theme seems to have an extra wrap around the contents of the site with a fixed width that needs to be removed. It’s called #innerwrap and can be found on line 158. Remove the width from here and add

      .wrap {
           margin: 0 auto;
           width: 980px;
      }
      

      You’ll also want to center your header background by adding ‘center’ after ‘no-repeat’ or a line like

      background-position:center; 
      

      Let me know if this works for you.

      • Jen says

        August 21, 2012 at 4:52 pm

        Yay, thanks Chris!

        I got the navigation to extend to the full width of the page! BUT – everything is still left justified. Can you help?

        Thanks!
        Jen

  16. panoptic says

    July 23, 2012 at 3:54 pm

    Thank you for all of your great tutorials!

    Is there a simple way to lock the footer to the bottom of the browser? My footer has a different background color and floats on larger monitors. I would like the footer to stay at the very bottom of the browser window regardless of the monitor height.

    • Christopher says

      August 18, 2012 at 1:11 pm

      Thank you for reading them!

      It’s a little tricky setting up a sticky footer since in most cases you need to remove the footer out of the wrap and do a little CSS trickery. This may help lead you in the right direction. Make sure to go to the bottom of the post sto see how to move the footer without hacking Genesis Core. http://teethgrinder.net/articles/2010/06/genesis-framework-sticky-footer/

  17. Mahesh says

    August 19, 2012 at 7:02 am

    I tried to do this with new sample theme and failed. I have my demo site on couponsnack.com (do checkthe top green nav which I want full width retaining the position of menus) where i just added the menu before header. I tried to follow your tutorial and also used firebug to find and replicate the process your explained to april in comments. It didn’t worked. I wonder what went wrong? :/

    • Christopher says

      August 20, 2012 at 11:37 am

      Not bad, almost got it.
      First, you’ll want to remove the #nav .wrap { width: %100; } since it’s making the containing area of the nav span the 100%, which will make the text go to each side of the screen. I didn’t go over this in the tutorial, but with backgrounds to span the entire width you’ll want to make sure they are on the section’s main div. So for example, your current nav the background is declared on #header .menu, you would want to remove it from here and set it to #nav. With it set on #header .menu it will be limited to the width of .wrap since it is constrained that area.
      I hope this makes sense.

      • Mahesh says

        August 21, 2012 at 1:30 am

        Yes. It worked. 🙂

        Thanks a lot, your explanation made it so easy for me to change, I just checked my code once and there’s my result.

Trackbacks

  1. Free Genesis Child Themes says:
    July 22, 2011 at 4:45 pm

    […] Full Width Child Theme by Christopher Cochran […]

  2. Reflex for Genesis Framework – A Blank, Responsive Child Theme says:
    January 1, 2013 at 12:12 pm

    […] I just released the first iteration of a blank child theme for the Genesis Framework, that I am calling Reflex. Brian Gardner blogged in October about the next version of Genesis (1.9) having mobile responsiveness baked in. Reflex is based around the blank child theme by Christopher Cochran at Genesistutorials.com. […]

Genesis Framework for WordPress

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Genesis Guide for Absolute Beginners

Click to download the Genesis Guide for Absolute Beginners

Follow me on Twitter

Follow @tweetsfromchris

Recent tutorials

Genesis 3.0.0 Removed Deprecated Functions

How to Add a Logo to the Header

Say Hello to the Genesis Visual Hook Guide v2.5

Genesis Tutorials • Built on the Genesis Theme Framework

Genesis Tutorials is not affiliated with StudioPress, and is maintained and operated by Christopher Cochran.

 

Loading Comments...