Genesis Tutorials

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

You are here: Home / Theming / Understanding Genesis Layout Options

Understanding Genesis Layout Options

January 27, 2011 by Christopher

Facebook0
Google+0
Twitter0

One of the ways genesis adds to its flexibility is having the option to choose a layout. This is great for anyone who doesn’t want a content/sidebar layout and would prefer possibly a 3 column layout like sidebar/content/sidebar or vice versa. Also for designers it’s possible to add classes to the body or post at post/page level to add even more flexibility in the design of the site. One use for the body class could be having several backgrounds pre-added to the stylesheet of your site and depending on the body class you can call a different images or color for each post. For example:

body.black {
     background-color:#000;
}
body.blue {
     background-color:#0000ff;
}
body.gray {
     background-color:#aaa;
}

Say you have created the above styles in your child themes style.css file and want a specific post to have a gray background. In the post edit page scroll down to “Genesis Layout Options” box and in the text box under “Custom Body Class” add “gray”.

Once the page/post is saved the class gray will be added to the body and the style applied.

How to unregister the default genesis layouts and register new layouts.

By default genesis comes with 6 layout options to choose for the entire site or per post/page basis. The six layouts genesis support are:

  • Content/Sidebar
  • Content/Sidebar/Sidebar
  • Sidebar/Sidebar/Content
  • Sidebar/Content/Sidebar
  • Sidebar/Content
  • Full Width Content

Unregistering Genesis Layout Options

Having six layout options is great in terms of allowing flexibility but for some genesis developers it may be extra work to support each of the six. In the latest version of genesis v1.4 it is now possible to unregister specific layouts.

To unregister a specific layout out just use genesis_unregister_layout( '$layout') in your child theme’s function.php. See the list below for specific layouts.

genesis_unregister_layout( 'full-width-content' );
genesis_unregister_layout( 'content-sidebar' );
genesis_unregister_layout( 'sidebar-content' );
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
genesis_unregister_layout( 'sidebar-content-sidebar' );

In addition to being able to remove support for specific layouts you can also remove the in-post and archive layout options.

remove_theme_support( 'genesis-inpost-layouts' );
remove_theme_support( 'genesis-archive-layouts' );

Registering custom layouts for genesis child themes

Though removing support for layouts is nice, the 1.4 update also allows adding your own ( which I believe a useful feature that not many speak about or know about). Since layouts can be unregistered there must be a function to register them as well – and there is.


For example purposes I will be going over how to create a “top bar – content – bottom bar” layout, but you can really create any layout your heart desires and I may be release some files for other layout options.

Registering a custom layout

To register a new layout use genesis_register_layout( $layoutid, $args) in your child theme’s function.php. $args takes the label ( name of layout ) and image ( to be used on in-post layout options )
An example of this:

genesis_register_layout( 'topbar-content-bottombar', array(
	'label' => 'Topbar/Content/Bottombar',
	'img' => CHILD_URL . '/images/stcsb.gif',
) );

Creating the site layout logic and specific sidebars

Basically now, there will be an option for the new registered layout and a class name on the body tag with the id of your new layout. However, there will be no logic with the sidebars and by default both will show. For this layout replace the two default sidebars sidebar-alt and sidebar with topbar and bottombar.

To create a conditional for the new layout use genesis_site_layout() in your child theme’s function.php. This function checks both the custom field and the theme option to find the user-selected site layout, and returns it.

add_action('genesis_before', 'gt_new_custom_layout_logic');
function gt_new_custom_layout_logic() {

	$site_layout = genesis_site_layout();
	
	if ( $site_layout == 'topbar-content-bottombar' ) {
                // Remove default genesis sidebars
		remove_action( 'genesis_after_content', 'genesis_get_sidebar' );
		remove_action( 'genesis_after_content_sidebar_wrap', 'genesis_get_sidebar_alt');
                // Add layout specific sidebars
		add_action( 'genesis_before_content', 'gt_get_sidebar_top' );
		add_action( 'genesis_after_content_sidebar_wrap', 'gt_get_sidebar_bottom' );	
	}
}

Now once the code is set up, to call the sidebars you have to create them. First create two files for a sidebar sidebar-top.phpand sidebar-bottom.php.

For each these templates I set them up with their own hooks but you don’t have to ( I kinda just fell in love with hooks and like to use them where I see fit. And if this was built into a plugin having hooks for the user to interact with will save them from having to modify its code ).

sidebar-top.php:

<div id="sidebar-top" class="widget-area">
<?php
	do_action( 'gt_before_sidebar_top_widget_area' );
	do_action( 'gt_sidebar_top' );
	do_action( 'gt_after_sidebar_top_widget_area' );
?>
</div>

sidebar-bottom.php:

<div id="sidebar-bottom" class="widget-area">
<?php
	do_action( 'gt_before_sidebar_bottom_widget_area' );
	do_action( 'gt_sidebar_bottom' );
	do_action( 'gt_after_sidebar_bottom_widget_area' );
?>
</div>

Next build and get the sidebars to be placed into their hooks by putting this code into in your child theme’s function.php.

genesis_register_sidebar(array(
    'name'=>'TopBar',
    'description' => 'This is the top widget area on TCB layouts'
));
genesis_register_sidebar(array(
    'name'=>'BottomBar',
    'description' => 'This is the bottom widget area on TCB layouts'
));
// hooks into sidebar-top.php to add the widget area
add_action( 'gt_sidebar_top', 'gt_do_sidebar_top' );
function gt_do_sidebar_top() {

	if ( !dynamic_sidebar( 'TopBar' ) ) {
		echo '...';
	}

}
// hooks into sidebar-bottom.php to add the widget area
add_action( 'gt_sidebar_bottom', 'gt_do_sidebar_bottom' );
function gt_do_sidebar_bottom() {
	
	if ( !dynamic_sidebar( 'BottomBar' ) ) {
		echo '...';	
	}
	
}
// Lets get our beautiful hooked up sidebars. These functions are added
// into the child theme back up in the layout logic.
function gt_get_sidebar_top() {
		get_sidebar( 'top' );	
}
function gt_get_sidebar_bottom() {
		get_sidebar( 'bottom' );	
}

That’s it. Can really use this to register any layout you can dream up. For styling the new layout the id is added to body class so in this case in your style.css you can use body.topbar-content-bottombar to style anything differently on this layout. Below is some basic CSS to get you started.

.topbar-content-bottombar #content-sidebar-wrap {
	width: 960px;
}

.topbar-content-bottombar #topbar {
	margin: 0 0 15px;
	width: 960px;
}
.topbar-content-bottombar #topbar {
	margin: 15px 0 0;
	width: 960px;
	float: left;
}

Also here is the gif I created to use for the new layout: stcsb.gif

Filed Under: Theming, Tutorial

About Christopher

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

Follow me on twitter @tweetsfromchris

Comments

  1. eknoc says

    February 6, 2011 at 2:55 am

    How about an example using the Custom Post Class. Nice tutorial.

    • Ryan says

      February 15, 2011 at 2:24 pm

      Good day…I am an intermediate developer, more graphic design than coding – while this tutorial is pretty descriptive, I am having trouble implementing the code.

      Where in the funtions.php file should I be placing the register and conditional codes? And should it be grouped together like the following:

      // Additional Layout Options
      genesis_register_layout( 'topbar-content-bottombar', array(
          'label' =&gt; 'Topbar/Content/Bottombar',
          'img' =&gt; CHILD_URL . '/images/stcsb.gif',
      ) );
      add_action('genesis_before', 'gt_new_custom_layout_logic');
      function gt_new_custom_layout_logic() {
       
          $site_layout = genesis_site_layout();
       
          if ( $site_layout == 'topbar-content-bottombar' ) {
                      // Remove default genesis sidebars
              remove_action( 'genesis_after_content', 'genesis_get_sidebar' );
              remove_action( 'genesis_after_content_sidebar_wrap', 'genesis_get_sidebar_alt');
                      // Add layout specific sidebars
              add_action( 'genesis_before_content', 'gt_get_sidebar_top' );
              add_action( 'genesis_after_content_sidebar_wrap', 'gt_get_sidebar_bottom' );
          }
      }
      genesis_register_sidebar(array(
          'name'=&gt;'TopBar',
          'description' =&gt; 'This is the top widget area on TCB layouts'
      ));
      genesis_register_sidebar(array(
          'name'=&gt;'BottomBar',
          'description' =&gt; 'This is the bottom widget area on TCB layouts'
      ));
      // hooks into sidebar-top.php to add the widget area
      add_action( 'gt_sidebar_top', 'gt_do_sidebar_top' );
      function gt_do_sidebar_top() {
       
          if ( !dynamic_sidebar( 'TopBar' ) ) {
              echo '...';
          }
       
      }
      // hooks into sidebar-bottom.php to add the widget area
      add_action( 'gt_sidebar_bottom', 'gt_do_sidebar_bottom' );
      function gt_do_sidebar_bottom() {
       
          if ( !dynamic_sidebar( 'BottomBar' ) ) {
              echo '...';
          }
       
      }
      // Lets get our beautiful hooked up sidebars. These functions are added
      // into the child theme back up in the layout logic.
      function gt_get_sidebar_top() {
              get_sidebar( 'top' );
      }
      function gt_get_sidebar_bottom() {
              get_sidebar( 'bottom' );
      }
      

      Thanks in advance for your help…

      • Birger Stamperdahl says

        February 15, 2011 at 11:05 pm

        I am trying to create an alternate sidebar to the right of content. I’ve tried using the following code based on your instructions. I’m definitely a novice at this, but thought for sure I had it right. I’m getting an error at the end of the code. The new sidebar is sidebar_nxt and the name is ‘BlogBar’ bar because I’m only using it for the blog section of the site.

        genesis_register_layout( ‘sidebar-nxt’, array(
        ‘label’ => ‘Content/Blogbar’,
        ) );

        add_action(‘genesis_before’, ‘gt_new_custom_layout_logic’);
        function gt_new_custom_layout_logic() {

        $site_layout = genesis_site_layout();

        if ( $site_layout == ‘sidebar-nxt’ ) {
        // Remove default genesis sidebars
        remove_action( ‘genesis_after_content’, ‘genesis_get_sidebar’ );
        remove_action( ‘genesis_after_content_sidebar_wrap’, ‘genesis_get_sidebar_alt’);
        // Add layout specific sidebars
        add_action( ‘genesis_after_content_sidebar_wrap’, ‘gt_get_sidebar_nxt’ );
        }
        }

        genesis_register_sidebar(array(
        ‘name’=>’BlogBar’,
        ‘description’ => ‘This is the widget area for the blog section’
        ));
        // hooks into sidebar-nxt.php to add the widget area
        add_action( ‘gt_sidebar_nxt’, ‘gt_do_sidebar_nxt’ );
        function gt_do_sidebar_nxt() {

        if ( !dynamic_sidebar( ‘BlogBar’ ) ) {
        echo ‘…’;
        }

        // Lets get our beautiful hooked up sidebars. These functions are added
        // into the child theme back up in the layout logic.
        function gt_get_sidebar_nxt() {
        get_sidebar( ‘after’ );
        }

        • Christopher says

          March 11, 2011 at 9:18 pm

          Seems to be right. What error is it throwing?

      • Christopher says

        March 11, 2011 at 9:17 pm

        Ryan, Yup that how it should look. you can drop it in functions after

         require_once(TEMPLATEPATH.'/lib/init.php'); 

        at the top of the document but before ?> at the end of the doc ( If it exists ).

  2. Drew says

    May 5, 2011 at 2:59 am

    How do I set it so that Pages have full width – without it affecting the default right sidebar for general posts?

    • Christopher says

      May 6, 2011 at 1:07 am

      you can use the genesis_pre_get_option_site_layout filter with a conditional for page like below.

      add_filter('genesis_pre_get_option_site_layout', 'gt_custom_page_layout');
      function gt_custom_page_layout( $opt ) {
          if ( is_page() )
          $opt = 'full-width-content';
          return $opt;
      }
      

      Just place the code in functions.php

  3. Rahul says

    May 23, 2011 at 1:36 am

    I am not using the tabs widget and thus want to remove it from functions with hope of making genesis more fast. Can you please tell me the way to do so.

  4. Quan says

    September 14, 2011 at 7:47 am

    how to customize the size of the sidebar. I want to use the Sidebar options / Content / Sidebar, width sidebar right = left sidebar.

  5. brooke says

    February 18, 2012 at 9:13 pm

    Thank you Christopher! You have no idea how much I appreciate this! I am completely new to WordPress & Genesis and I’ve spent hours researching with the best results coming from 2 of your posts! Can I make you some chocolate pastries of something? LOL.

    • Christopher says

      February 18, 2012 at 9:24 pm

      Oh my, Chocolate pastries sounds awesome!:) Glad my posts could help!

  6. Miranda Grimm says

    March 16, 2012 at 2:46 am

    I feel at a complete loss. I am trying to change the background image on a single page. I have attempted multiple suggestions, one of which was your custom body class suggested above. But it doesn’t work for me. I must not be getting something basic and obvious…

  7. Donco says

    March 16, 2012 at 11:16 pm

    Wow… You blew me away again with this ever so easy to understand tutorial.

    Suggestion: Write an e-book or do some videos and sell them.. I am sure that people will buy them. Your writing style is so easy to follow. It makes sense to the non-developer person. I know that sounds funny, but this stuff is not rocket science. However, you are the first person that I have found that writes in such an easy way for a layperson to understand.

    I sincerely thank you for taking the time to share this valuable info on your website. Your hard work and attention to detail in helping the Genesis community understand the power of the framework is appreciated immensely.

    Gracias…

Trackbacks

  1. Tweets that mention Understanding Genesis Layout Options – Genesis Tutorials -- Topsy.com says:
    January 27, 2011 at 6:25 am

    […] This post was mentioned on Twitter by Brad Potter and Scott Basgaard, Christopher Cochran. Christopher Cochran said: Bet you didn't know you could do this with #GenesisWP –> http://goo.gl/TMAbm ( Register your own layout options ) […]

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

4 Pound Minimum Deposit Casino UK 2026: Low-Stakes Play Without the Fairy Tale

500 Free Spins No Deposit UK 2026: How to Claim and Avoid the Traps

Copyright © 2026 · Genesis Framework · WordPress · Log in

 

Loading Comments...
 

    A practical 2026 guide to 25 free spins no deposit UK offers: what they really are, which casinos run them, how wagering kills most wins, and how to claim without getting burned. read the full 25 free spins no deposit UK guide

    A realistic guide to 250 free spins no deposit UK 2026. We break down real offer types, compare UK licensed casinos, explain wagering, and show which no deposit spins are actually worth claiming. read the realistic guide to 250 free spins no deposit UK 2026

    A practical guide to UK-licensed casinos that still accept £3 minimum deposits in 2026, including payment methods, bonus traps, and a comparison table of real brands. read the full £3 minimum deposit casino guide

    A practical guide to 30 free spins no deposit offers for UK players in 2026: how they work, what the wagering small print really means, which casinos stand out, and how to claim real value without falling for the usual traps. read the 30 free spins no deposit UK guide

    A no-nonsense guide to 30, 50, 100 and 150 free spins no deposit offers at UK casinos. We compare real brands, explain wagering, and show how to spot a bonus worth claiming. read the complete guide to no deposit free spins

    A practical guide to UK casinos with low minimum deposits near £4, including a ranked comparison table, bonus truth, payment methods, and safety checks for 2026. read the full low deposit casino guide

    A no-nonsense guide to 40 free spins no deposit offers at UK casinos in 2026. We break down the real terms, list top casinos, and explain how to avoid the usual traps. read our 40 free spins no deposit UK 2026 guide

    Find the best £5 minimum deposit casinos in the UK for 2026. Compare licensed operators, bonuses, payment methods, and real money games. Play smart with a fiver. read the full £5 minimum deposit casino guide

    A no-nonsense guide to claiming 50 free spins with no deposit at UK online casinos in 2026, including the operators that still run these offers, the wagering traps, and how to avoid wasting your time on fake 'free' bonuses. read the full guide to 50 free spins no deposit offers for UK players

    A no-nonsense UK guide to 500 free spins no deposit offers in 2026: how the promotions really work, which casinos run them, and what to check before claiming. read our UK guide to 500 free spins no deposit 2026