Skip to content

Instantly share code, notes, and snippets.

@deckerweb
Last active March 2, 2022 05:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deckerweb/4549753 to your computer and use it in GitHub Desktop.
Save deckerweb/4549753 to your computer and use it in GitHub Desktop.
Genesis: Education 2.0 Child Theme -- Add widget support for the Education 2.0 homepage. If no widgets active, display the default loop.
<?php
/** Add support for widgetized home page */
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'ddw_education_home_loop_helper' );
/**
* Add widget support for the Education 2.0 homepage.
* If no widgets active, display the default loop.
*
* @author David Decker - DECKERWEB
* @link http://twitter.com/deckerweb
*/
function ddw_education_home_loop_helper() {
/** Homepage widget active */
if ( is_active_sidebar( 'education-home-area' ) ) {
dynamic_sidebar( 'education-home-area' );
}
/** If no active widget area fall back to default loop */
else {
genesis_standard_loop();
} // end if/else
} // end of function
<?php
/**
* Add widget area for a widgetized homepage in Education 2.0.
*
* @author David Decker - DECKERWEB
* @link http://twitter.com/deckerweb
*/
genesis_register_sidebar( array(
'id' => 'education-home-area',
'name' => __( 'Education Home', 'education' ),
'description' => __( 'Widgetized homepage area.', 'education' ),
) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment