WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

Mar 18 2011

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]

Written by Travis Smith · Categorized: Genesis, Tutorials

StudioPress Premium WordPress Themes     WP Engine Managed WordPress Hosting

What can I do for you!?

Custom Development

We develop plugins by determining both business/functional and technical requirements, following WordPress development best practices, and using agile methodology to ensure you get the best solution.

Consulting

Have questions? Need a reliable developer to consult? Please contact us today!

Customized Theme

We can customize your theme or child theme, or create a child theme for you based on your needs while enhancing the performance of every individual attribute.

Customized Plugin

We can customize your plugins, extend plugins (e.g., Gravity Forms, Jetpack, Soliloquy) based on your needs ensuring security, performance, and positive business impact.

Contact Us

About Travis Smith

As a WordPress enthusiast, developer, and speaker, Travis writes about what he learns in WordPress trying to help other WordPress travelers, beginners and enthusiasts with tutorials, explanations, & demonstrations.

Comments

  1. kuldeep says

    May 29, 2011 at 1:19 am

    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

    Reply
    • wpsmith says

      June 5, 2011 at 9:26 pm

      Thanks for the tip!

      Reply
  2. Peter Griffyn says

    October 26, 2011 at 7:12 am

    Love ya work Smiffy!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

Copyright © 2025 � WP Smith on Genesis on Genesis Framework � WordPress � Log in