Add Home Middle Widgets to Outreach Pro Themes Front Page

This tutorial provides all the PHP code you can replace in the default front-page.php file included in the Outreach Pro child theme by StudioPress.

The code adds a home middle widget which spans full width:

<?php
/**
 * This file adds the Home Page to the Outreach Pro Theme.
 *
 * @author Brad Dalton
 * @package Outreach Pro
 * @subpackage Customizations
 */

add_action( 'genesis_meta', 'outreach_home_genesis_meta' );
/**
 * Add widget support for homepage. If no widgets active, display the default loop.
 *
 */
function outreach_home_genesis_meta() {

	if ( is_active_sidebar( 'home-top' )  || is_active_sidebar( 'home-middle' ) || is_active_sidebar( 'home-bottom' ) ) {

		//* Force full-width-content layout setting
		add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
		
		//* Add outreach-pro-home body class
		add_filter( 'body_class', 'outreach_body_class' );
		
		//* Remove breadcrumbs
		remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );

		//* Remove the default Genesis loop
		remove_action( 'genesis_loop', 'genesis_do_loop' );
		
		//* Add home top widgets
		add_action( 'genesis_loop', 'outreach_home_top_widgets' );
		
			//* Add home bottom widgets
		add_action( 'genesis_before_footer', 'outreach_home_middle_widgets', 1 );

		//* Add home bottom widgets
		add_action( 'genesis_before_footer', 'outreach_home_bottom_widgets', 2 );

	}

}

function outreach_body_class( $classes ) {

	$classes[] = 'outreach-pro-home';
	return $classes;
	
}

function outreach_home_top_widgets() {

	genesis_widget_area( 'home-top', array(
		'before' => '<div class="home-top widget-area">',
		'after'  => '</div>',
	) );
	
}

function outreach_home_middle_widgets() {

	genesis_widget_area( 'home-middle', array(
		'before' => '<div class="home-middle widget-area"><div class="wrap">',
		'after'  => '</div>',
	) );
	
}

function outreach_home_bottom_widgets() {
	
	genesis_widget_area( 'home-bottom', array(
		'before' => '<div class="home-bottom widget-area"><div class="wrap">',
		'after'  => '</div></div>',
	) );

}

genesis();

Now you can register the new widget by adding the following PHP code to the end of your child themes functions.php file:

genesis_register_sidebar( array(
	'id'          => 'home-middle',
	'name'        => __( 'Home - Middle', 'outreach' ),
	'description' => __( 'This is the middle section of the Home page.', 'outreach' ),
) );

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.