Skip to content

Instantly share code, notes, and snippets.

@shazdeh
Created January 30, 2014 22:29
Show Gist options
  • Save shazdeh/8721416 to your computer and use it in GitHub Desktop.
Save shazdeh/8721416 to your computer and use it in GitHub Desktop.
Features and Bottom widget areas
<?php
add_action( 'widgets_init', 'register_layout_widget_areas' );
add_action( 'themify_layout_before', 'display_features_area' );
add_action( 'themify_layout_after', 'display_bottom_area' );
function register_layout_widget_areas() {
register_sidebar(array(
'name' => __( 'Features' ),
'id' => 'features',
'description' => __( 'Displays the widgets above the content area.' ),
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>',
'before_widget' => '<div class="widgetwrap"><div id="%1$s" class="widget %2$s">',
'after_widget' => '</div></div>',
));
register_sidebar(array(
'name' => __( 'Bottom' ),
'id' => 'bottom',
'description' => __( 'Displays the widgets below the content area.' ),
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>',
'before_widget' => '<div class="widgetwrap"><div id="%1$s" class="widget %2$s">',
'after_widget' => '</div></div>',
));
}
function display_features_area() {
if( is_active_sidebar( 'features' ) ) {
echo '<div class="features" id="features">';
dynamic_sidebar( 'features' );
echo '</div>';
}
}
function display_bottom_area() {
if( is_active_sidebar( 'bottom' ) ) {
echo '<div class="bottom" id="bottom">';
dynamic_sidebar( 'bottom' );
echo '</div>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment