Skip to content

Instantly share code, notes, and snippets.

@neilgee
Created August 30, 2015 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neilgee/9b7e9ce1d2558bd33cf5 to your computer and use it in GitHub Desktop.
Save neilgee/9b7e9ce1d2558bd33cf5 to your computer and use it in GitHub Desktop.
Genesis Home Page
<?php
//Add in Wrap Content Widget Areas
function genesischild_fullwrap_widgets() {
if(is_home() && is_front_page()) {
register_sidebar( array(
'name' => __( 'TopWrap', 'genesis' ),
'id' => 'topwrap',
'description' => __( 'TopWrap', 'genesis' ),
'before_widget' => '<div class="wrap topwrap">',
'after_widget' => '</div>',
) );
register_sidebar( array(
'name' => __( 'OptinWrap', 'genesis' ),
'id' => 'optinwrap',
'description' => __( 'OptinWrap', 'genesis' ),
'before_widget' => '<div class="wrap optinwrap">',
'after_widget' => '</div>',
) );
register_sidebar( array(
'name' => __( 'BottomWrap', 'genesis' ),
'id' => 'bottomwrap',
'description' => __( 'BottomWrap', 'genesis' ),
'before_widget' => '<div class="wrap botwrap">',
'after_widget' => '</div>',
) );
}
}
add_action( 'widgets_init', 'genesischild_fullwrap_widgets' );
@bryanwillis
Copy link

You could also do something like this for before_widget:

 'before_widget' => sprintf( '<div %s>', genesis_attr( 'topwrap' ) ),

Then you can filter the before widget classes

add_filter( 'genesis_attr_full-wrap', 'brw_genesis_attr_full_wrap' );
function brw_genesis_attr_full_wrap( $attributes ){
    $attributes['class'] =  $attributes['class'] . ' ' . 'wrap';
    return $attributes;
}

There's also genesis_widget_area which I think does something similar to that extent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment