Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* This file adds the Home Page to the WBXPress Theme.
*
* @author WBXPress
* @package WBXPress
* @subpackage Customizations
*/
add_action( 'genesis_meta', 'wbxpress_home_genesis_meta' );
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
*/
function wbxpress_home_genesis_meta() {
if ( is_active_sidebar( 'home-top-1' ) || is_active_sidebar( 'home-middle' ) || is_active_sidebar( 'home-bottom-1' ) ) {
//* Force full-width-content layout setting
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
//* Add wbxpress-home body class
add_filter( 'body_class', 'wbxpress_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_after_header', 'wbxpress_home_top_widgets' );
//* Add home middle widgets
add_action( 'genesis_after_loop', 'wbxpress_home_middle_widgets' );
//* Add home bottom widgets
add_action( 'genesis_before_footer', 'wbxpress_home_bottom_widgets', 1 );
}
}
function wbxpress_body_class( $classes ) {
$classes[] = 'wbxpress-home';
return $classes;
}
function wbxpress_home_top_widgets() {
genesis_widget_area( 'home-top-1', array(
'before' => '<div class="home-top-1 widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
genesis_widget_area( 'home-top-2', array(
'before' => '<div class="home-top-2 widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
}
function wbxpress_home_middle_widgets() {
genesis_widget_area( 'home-middle', array(
'before' => '<div class="home-middle widget-area">',
'after' => '</div>',
) );
}
function wbxpress_home_bottom_widgets() {
genesis_widget_area( 'home-bottom-1', array(
'before' => '<div class="home-bottom-1 widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
genesis_widget_area( 'home-bottom-2', array(
'before' => '<div class="home-bottom-2 widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
genesis_widget_area( 'home-bottom-3', array(
'before' => '<div class="home-bottom-3 widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
}
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.