Skip to content

Instantly share code, notes, and snippets.

@tacoverdo
Last active December 22, 2015 19:39
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 tacoverdo/6521478 to your computer and use it in GitHub Desktop.
Save tacoverdo/6521478 to your computer and use it in GitHub Desktop.
Simple way to add a widgetarea to a Genesis Childtheme
<?php
/**
* Register widget areas for Genesis Childthemes
* Includes i18n for name and description.
*/
genesis_register_sidebar( array(
'id' => 'Widgetarea_slug',
'name' => __( 'Title of your widgetarea', 'example' ),
'description' => __( 'Description that is shown in the admin of your WordPress website', 'example' ),
) );
/**
* Adds widgetarea to your site.
*/
function tv_add_widgetarea_to_theme_genesis() {
echo '<div id="widgetarea_containerdiv"><div class="wrap">';
// Change 'true' to specific page to show/hide widget area on that page
// E.g. is_home()
if ( true ) {
genesis_widget_area( 'Widgetarea_slug', array(
'before' => '<div id="widgetarea_div_id" class="widgetarea_div_class">',
'after' => '</div>',
) );
}
}
add_action( 'genesis_after_header', 'tv_add_widgetarea_to_theme_genesis' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment