Last active
December 22, 2015 19:39
-
-
Save tacoverdo/6521478 to your computer and use it in GitHub Desktop.
Simple way to add a widgetarea to a Genesis Childtheme
This file contains 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 | |
/** | |
* 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