Created
November 8, 2013 07:28
-
-
Save shazdeh/7367465 to your computer and use it in GitHub Desktop.
Content widget areas. Registers two widget areas that are displayed above and below the main content area.
This file contains hidden or 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 | |
add_action( 'widgets_init', 'register_content_widget_areas' ); | |
add_action( 'themify_content_start', 'display_content_top_area' ); | |
add_action( 'themify_content_end', 'display_content_bottom_area' ); | |
function register_content_widget_areas() { | |
register_sidebar(array( | |
'name' => __( 'Content Top' ), | |
'id' => 'content-top', | |
'description' => __( 'Displays the widgets above the content area.' ), | |
'before_title' => '<h3 class="widget-title">', | |
'after_title' => '</h3>', | |
'before_widget' => '<div id="%1$s" class="widget %2$s">', | |
'after_widget' => '</div>', | |
)); | |
register_sidebar(array( | |
'name' => __( 'Content Bottom' ), | |
'id' => 'content-bottom', | |
'description' => __( 'Displays the widgets below the content area.' ), | |
'before_title' => '<h3 class="widget-title">', | |
'after_title' => '</h3>', | |
'before_widget' => '<div id="%1$s" class="widget %2$s">', | |
'after_widget' => '</div>', | |
)); | |
} | |
function display_content_top_area() { | |
if( is_active_sidebar( 'content-top' ) ) { | |
echo '<div class="content-top" id="content-top">'; | |
dynamic_sidebar( 'content-top' ); | |
echo '</div>'; | |
} | |
} | |
function display_content_bottom_area() { | |
if( is_active_sidebar( 'content-bottom' ) ) { | |
echo '<div class="content-bottom" id="content-bottom">'; | |
dynamic_sidebar( 'content-bottom' ); | |
echo '</div>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment