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]
kuldeep says
this is more powerfull and easy
ad below code after ——-> require_once(TEMPLATEPATH.’/lib/init.php’);
and before ———> ?> (if it exist)
####CODE####CODE#######CODE######CODE#######
//Adds an ad block above the header
genesis_register_sidebar(array(
‘name’=>’Above Header Ad’,
‘id’=>’above-header-ad’,
‘description’ => ‘This is the ad block above the header’,
‘before_title’=>”,’after_title’=>”,
‘before_widget’ =>”, ‘after_widget’ => ”
));
add_action(‘genesis_above_header’, ‘above_header_ad’);
function above_header_ad() {
dynamic_sidebar(‘Above Header Ad’);
}
and use this css in style.css (paste anywhere but in the end-recommended)
/**************
For above header ad
****************/
#adspace {
width: 960px;
margin: 0;
padding-top: 8px;
height: 100px;
text-align: center;
}
You can also replace genesis_above_header HOOK with any other hook you want like
genesis_before_header
genesis_before_post
wpsmith says
Thanks for the tip!
Peter Griffyn says
Love ya work Smiffy!