Site icon WP Smith

How to Make the Top Section (above Sidebar/Content) Widgetized in the Genesis Framework

To make the area before the loop (or rather, the area before the sidebar/content area after the header) widgetized, add the following to your functions.php file:

[php]
genesis_register_sidebar( array(
'id' => 'genesis_before_content_sidebar_widget',
'name' => __( 'Before Content', 'genesis' ),
'description' => __( 'This is the main section after the header before the content/sidebar.', 'focus' ),
) );

add_action( 'genesis_before_content_sidebar_wrap', 'genesis_before_content_sidebar_widget_box' );
function genesis_before_content_sidebar_widget_box() {
if ( is_single() || is_home() || is_category || is_archive || is_page || is_front_page ) {
?>
<?php if ( is_active_sidebar( 'genesis_before_content_sidebar_widget' ) ) : ?>
<div class="before-content">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('genesis_before_content_sidebar_widget') ) : ?>
<div class="widget">
<h3><?php _e( 'Top Widget Area', 'focus' ); ?></h3>
<p><?php _e("This is an example of a widget area that you can place text to describe a product or service. You can also use other WordPress widgets such as recent posts, recent comments, a tag cloud or more.", 'genesis'); ?></p>
</div><!-- end .widget -->
<?php endif; ?>
</div>
<?php endif; ?>
<?php
} }
[/php]