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 / Snippets / Force Genesis Child Theme Home Layout

Force Genesis Child Theme Home Layout

June 22, 2010 by 3 Comments

The snippet below will force the homepage layout of your child theme.

New Way

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

Old Way

add_filter('genesis_options', 'custom_home_layout', 10, 2);
function custom_home_layout($options, $setting) {
	if($setting == GENESIS_SETTINGS_FIELD) {
		if(is_home())
		$options['site_layout'] = 'full-width-content';
	}
	return $options;
}

* Note This code can be used to force the layout for pages, categories, archives and page templates. Just change is_home() to the conditonal you want. For use in a custom page template files just include it before genesis():

Layout Options:
content-sidebar Content/Sidebar
content-sidebar-sidebar Content/Sidebar/Sidebar
sidebar-sidebar-content Sidebar/Sidebar/Content
sidebar-content-sidebar Sidebar/Content/Sidebar
full-width-content Full Width Content

Comments

  1. Morgan Finley says

    October 18, 2010 at 5:12 am

    I adapted this to force a layout on a category page template by using the following:

    add_filter('genesis_options', 'themename_category_layout', 10, 2);
    function themename_category_layout($options, $setting) {
    	if($setting == GENESIS_SETTINGS_FIELD) {
    		if(is_category())
    		$options['site_layout'] = 'full-width-content';
    	}
    	return $options;
    }
    

    Thanks, it works great. I’m a designer just getting into genesis and exploring custom child themes. I have been looking at code examples from here and from the StudioPress forums. Mostly, I have been looking for ways to manipulate the layouts, and this is very helpful.

    Reply
    • Christopher says

      October 18, 2010 at 3:17 pm

      Glad I could help! And thanks for the comment and snippet! I will be updating the site soon with many more snippets (I have quite a few) and the option for anyone to submit theirs.

      Anyways, just to let you know I’ve updated the code above. There is a newer way to force the site (I have to check if the old way still works in the latest version of genesis).

      Reply
      • Morgan Finley says

        October 18, 2010 at 11:03 pm

        Thanks, I made the same changes to the new code and it works like a charm.

        I look forward to more snippets and code tips.

        Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

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.