Title: Widgetized Custom Homepage Template: Separating the Code for Function.php and t
Last modified: August 21, 2016

---

# Widgetized Custom Homepage Template: Separating the Code for Function.php and t

 *  [satrap](https://wordpress.org/support/users/satrap/)
 * (@satrap)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/widgetized-custom-homepage-template-separating-the-code-for-functionphp-and-t/)
 * I am trying to create a new Widgetized custom homepage on the actual Genesis 
   Framework theme (I like the style for the most part, but of course I created 
   a child theme based on that for customizations).
 * I got everything working by basically registering and hooking new widgets in 
   the function.php.
 * However, I want to basically create a new homepage template (front-page.php or
   home.php, etc). But I can’t figure out what part of the code should go into this
   new template and what part should stay in the function.php. I can’t structure
   it right and so it doesn’t work.
 * Here is my function.php code which contains the widgets for the homepage:
 *     ```
       <?php
       // Start the engine the other way
   
       add_action('genesis_setup','genesischild_theme_setup', 15);
       function genesischild_theme_setup() { 
   
       //Add support for HTML5 markup
       add_theme_support( 'html5' );
   
       //Add viewport metatag
       add_theme_support( 'genesis-responsive-viewport' );
   
       //Add 3 footer widgets
       add_theme_support( 'genesis-footer-widgets', 3 );
   
       //Add support for custom background
       add_theme_support( 'custom-background' );
   
       // Remove post meta
       remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
   
       // Execute custom home page. If no widgets active, then loop
   
       	remove_action( 'genesis_loop', 'genesis_do_loop' );
       	add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
   
       // Register Home page widgets
   
       genesis_register_sidebar( array(
       	'id'          => 'parallax-section-below-header',
       	'name'        => __( 'Parallax Section Below Header', 'geeta' ),
       	'description' => __( 'This is the parallax section below header.', 'geeta' ),
       ) );
   
       genesis_register_sidebar( array(
       	'id'          => 'home-section-1',
       	'name'        => __( 'Home Section 1', 'geeta' ),
       	'description' => __( 'This is the Home Section 1.', 'geeta' ),
       ) );
   
       genesis_register_sidebar( array(
       	'id'          => 'home-section-2',
       	'name'        => __( 'Home Section 2', 'geeta' ),
       	'description' => __( 'This is the Home Section 2.', 'geeta' ),
       ) );
   
       genesis_register_sidebar( array(
       	'id'          => 'home-section-3',
       	'name'        => __( 'Home Section 3', 'geeta' ),
       	'description' => __( 'This is the Home Section 3.', 'geeta' ),
       ) );
   
       genesis_register_sidebar( array(
       	'id'          => 'home-section-4',
       	'name'        => __( 'Home Section 4', 'geeta' ),
       	'description' => __( 'This is the Home Section 4.', 'geeta' ),
       ) );
   
       genesis_register_sidebar( array(
       	'id'          => 'home-section-5',
       	'name'        => __( 'Home Section 5', 'geeta' ),
       	'description' => __( 'This is the Home Section 5.', 'geeta' ),
       ) );
   
       //* Hooks parallax-section-below-header widget area after header
       add_action( 'genesis_after_header', 'parallax_section_below_header' );
       function parallax_section_below_header() {
       if ( ! is_home() )
       return;
       	genesis_widget_area( 'parallax-section-below-header', array(
       		'before' => '<div class="below-header parallax-section widget-area"><div class="wrap">',
       		'after'  => '</div></div>',
       	) );
       }
   
       //* Hooks home-section-1 widget area after header
       add_action( 'genesis_after_header', 'home_section_1' );
       function home_section_1() {
   
       if ( ! is_home() )
       return;
       	genesis_widget_area( 'home-section-1', array(
       		'before' => '<div class="below-header home-section-1 widget-area"><div class="wrap">',
       		'after'  => '</div></div>',
       	) );
       }
   
       //* Hooks home-section-2 widget area after header
       add_action( 'genesis_after_header', 'home_section_2' );
       function home_section_2() {
   
       if ( ! is_home() )
       return;
       	genesis_widget_area( 'home-section-2', array(
       		'before' => '<div class="below-header home-section-2 widget-area"><div class="wrap">',
       		'after'  => '</div></div>',
       	) );
       }
   
       //* Hooks home-section-3 widget area after header
       add_action( 'genesis_after_header', 'home_section_3' );
       function home_section_3() {
       if ( ! is_home() )
       return;
       	genesis_widget_area( 'home-section-3', array(
       		'before' => '<div class="below-header home-section-3 widget-area"><div class="wrap">',
       		'after'  => '</div></div>',
       	) );
       }
   
       //* Hooks home-section-4 widget area after header
       add_action( 'genesis_after_header', 'home_section_4' );
       function home_section_4() {
       if ( ! is_home() )
       return;
       	genesis_widget_area( 'home-section-4', array(
       		'before' => '<div class="below-header home-section-4 widget-area"><div class="wrap">',
       		'after'  => '</div></div>',
       	) );
       }
   
       //* Hooks home-section-5 widget area after header
       add_action( 'genesis_after_header', 'home_section_5' );
       function home_section_5() {
       if ( ! is_home() )
       return;
       	genesis_widget_area( 'home-section-5', array(
       		'before' => '<div class="below-header home-section-5 widget-area"><div class="wrap">',
       		'after'  => '</div></div>',
       	) );
       }
   
       }
       ```
   
 * Or if the code above is broken, see it here @ [http://pastebin.com/w5JGCnKY](http://pastebin.com/w5JGCnKY)
 * I would appreciate if anyone could help me basically separate the code (what 
   should go in the new template and what should stay in the function.php).
 * Thank you so much in advance.

The topic ‘Widgetized Custom Homepage Template: Separating the Code for Function.
php and t’ is closed to new replies.

## Tags

 * [custom homepage](https://wordpress.org/support/topic-tag/custom-homepage/)
 * [genesis](https://wordpress.org/support/topic-tag/genesis/)

 * 0 replies
 * 1 participant
 * Last reply from: [satrap](https://wordpress.org/support/users/satrap/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/widgetized-custom-homepage-template-separating-the-code-for-functionphp-and-t/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
