Skip to content

Instantly share code, notes, and snippets.

@SusanRamsey
Created August 25, 2017 00:33
Show Gist options
  • Save SusanRamsey/7d07655e4b1799b9bcf653cfa55cac32 to your computer and use it in GitHub Desktop.
Save SusanRamsey/7d07655e4b1799b9bcf653cfa55cac32 to your computer and use it in GitHub Desktop.
Pretty Theme Front Page without widgets on subsequent pages...
<?php
/**
* This file adds the Home Page to the Pretty Theme.
*
* @author Lindsey Riel
* @package Pretty
*/
//* Force full-width-content layout setting
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
add_action( 'genesis_meta', 'pretty_home_genesis_meta' );
/**
* Add widget support for home page. If no widgets active, display the default loop.
*
*/
function pretty_home_genesis_meta() {
if ( is_active_sidebar( 'home-featured' ) || is_active_sidebar( 'home-slider-widget' )|| is_active_sidebar( 'home-subscribe' )) {
//* Display loop after home page widgets
add_action( 'genesis_after_header', 'pretty_home_widgets' );
}
}
if ( !is_paged() ) {
//* Add home page widgets
function pretty_home_widgets() {
echo '<div id="home-page-widgets">';
genesis_widget_area( 'home-featured', array(
'before' => '<div id="home-featured" class="home-featured"><div class="widget-area"><div class="wrap">',
'after' => '</div></div></div>',
) );
genesis_widget_area( 'home-slider-widget', array(
'before' => '<div id="home-slider-widget" class="home-slider-widget"><div class="widget-area"><div class="wrap">',
'after' => '</div></div></div>',
) );
genesis_widget_area( 'home-subscribe', array(
'before' => '<div id="home-subscribe" class="home-subscribe"><div class="widget-area"><div class="wrap">',
'after' => '</div></div></div>',
) );
echo "</div>";
}
}
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment