Created
November 26, 2014 17:30
-
-
Save kontikidigital/0058d677dbbe91a7b853 to your computer and use it in GitHub Desktop.
Creating a custom widgetized Front page in Genesis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This file adds the Home Page to the Executive Pro Theme. | |
* | |
* @author TargetIMC | |
* @package Generate | |
* @subpackage Customizations | |
*/ | |
add_action( 'genesis_meta', 'targetimc_home_genesis_meta' ); | |
/** | |
* Add widget support for homepage. If no widgets active, display the default loop. | |
* | |
*/ | |
function targetimc_home_genesis_meta() { | |
if ( is_active_sidebar( 'home-text-section' ) || is_active_sidebar( 'home-featured-left' ) || is_active_sidebar( 'home-featured-right' ) || is_active_sidebar( 'sponsor-logos' ) ) { | |
remove_action( 'genesis_loop', 'genesis_do_loop' ); | |
add_action( 'genesis_loop', 'executive_home_sections' ); | |
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); | |
} | |
} | |
function targetimc_home_sections() { | |
genesis_widget_area( 'home-text-section', array( | |
'before' => '<div class="home-text-section widget-area">', | |
'after' => '</div>', | |
) ); | |
echo '<div class="home-featured"><div class="wrap">'; | |
genesis_widget_area( 'home-featured-left', array( | |
'before' => '<div class="home-featured-left widget-area one-half first">', | |
'after' => '</div>', | |
) ); | |
genesis_widget_area( 'home-featured-right', array( | |
'before' => '<div class="home-featured-right widget-area one-half">', | |
'after' => '</div>', | |
) ); | |
echo '</div></div>'; | |
genesis_widget_area( 'home-blog', array( | |
'before' => '<div class="home-blog widget-area">', | |
'after' => '</div>', | |
) ); | |
} | |
genesis(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Do NOT include the opening php tag//* Reposition the primary navigation menu | |
//* Reposition the primary navigation menu | |
remove_action( 'genesis_after_header', 'genesis_do_nav' ); | |
add_action( 'genesis_before_header', 'genesis_do_nav' ); | |
//* Remove the default header | |
remove_action( 'genesis_header', 'genesis_do_header' ); | |
//* Add custom header | |
add_action( 'genesis_header', 'tgt_do_header' ); | |
function tgt_do_header() { | |
echo '<a href="/"><img src="http://placehold.it/1140x200" /></a>'; | |
} | |
genesis_register_sidebar( array( | |
'id' => 'home-text-section', | |
'name' => 'Home Text Section', | |
'description' => 'This is the Home Text section' | |
) ); | |
genesis_register_sidebar( array( | |
'id' => 'home-featured-left', | |
'name' => 'Home Featured Left', | |
'description' => 'This is the Home Featured Left section' | |
) ); | |
genesis_register_sidebar( array( | |
'id' => 'home-featured-right', | |
'name' => 'Home Featured Right', | |
'description' => 'This is the Home Featured Right section' | |
) ); | |
genesis_register_sidebar( array( | |
'id' => 'home-blog', | |
'name' => 'Home Blog', | |
'description' => 'This is the Home Blog section' | |
) ); | |
genesis_register_sidebar( array( | |
'id' => 'sponsor-logos', | |
'name' => 'Sponsor Logos', | |
'description' => 'This is the Sponsors section' | |
) ); | |
add_action( 'genesis_before_footer', 'tgt_sponsor_logos' ); | |
function tgt_sponsor_logos() { | |
genesis_widget_area( 'sponsor-logos', array( | |
'before' => '<div class="sponsor-logos widget-area"><div class="wrap">', | |
'after' => '</div></div>', | |
) ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.site-header .wrap { | |
padding-top: 0; | |
padding-bottom: 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment