Community Forums › Forums › Archived Forums › Design Tips and Tricks › Create widget areas within a sidebar
- This topic has 1 reply, 2 voices, and was last updated 11 years, 6 months ago by Pinky.
-
AuthorPosts
-
February 28, 2013 at 4:24 pm #23373TravisPriMember
Hi there,
I am trying to create widget areas within a sidebar. I am using the Minimum theme, which has a "home featured" sidebar, and within it, there are widget areas "home featured 1," "home featured 2," etc.
I know how to register a new sidebar and call it, etc. but I can't figure out how to make a sidebar with essentially more sidebars within it. The goal is to create a second "home featured" area with 2 widget areas inside it.
This is the php that creates the "home featured" sidebar with home featured 1, 2, 3 inside it:
function minimum_home_genesis_meta() { if ( is_active_sidebar( 'home-featured-1' ) || is_active_sidebar( 'home-featured-2' ) || is_active_sidebar( 'home-featured-' ) || is_active_sidebar( 'home-featured-4' ) ) { add_action( 'genesis_after_header', 'minimum_home_featured', 15 ); add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); add_filter( 'body_class', 'minimum_add_body_class' ); function minimum_add_body_class( $classes ) { $classes[] = 'minimum'; return $classes; } } } function minimum_home_featured() { echo '<div id="home-featured"><div class="wrap">'; genesis_widget_area( 'home-featured-1', array( 'before' => '<div class="home-featured-1 widget-area">', ) ); genesis_widget_area( 'home-featured-2', array( 'before' => '<div class="home-featured-2 widget-area">', ) ); genesis_widget_area( 'home-featured-3', array( 'before' => '<div class="home-featured-3 widget-area">', ) ); genesis_widget_area( 'home-featured-4', array( 'before' => '<div class="home-featured-4 widget-area">', ) ); echo '</div><!-- end .wrap --></div><!-- end #minimum -->'; }
Thanks for your help!
March 15, 2013 at 10:11 pm #27300PinkyMemberI haven't tested this - but you could try:
function minimum_home_genesis_meta() { if ( is_active_sidebar( 'home-featured-5' ) || is_active_sidebar( 'home-featured-6' ) ) { add_action( 'genesis_after_home_featured', 'minimum_home_featured', 15 ); add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); add_filter( 'body_class', 'minimum_add_body_class' ); function minimum_add_body_class( $classes ) { $classes[] = 'minimum'; return $classes; } } } function minimum_home_featured() { echo '<div id="home-featured-bottom"><div class="wrap">'; genesis_widget_area( 'home-featured-5', array( 'before' => '<div class="home-featured-5 widget-area">', ) ); genesis_widget_area( 'home-featured-6', array( 'before' => '<div class="home-featured-6 widget-area">', ) ); echo '</div><!-- end .wrap --></div><!-- end #minimum -->'; }
then add something like this to style.css
.home-featured-5, .home-featured-6 { float: left; margin: 0; overflow: hidden; text-align: center; width: 50%; }
And then it's just a matter of putting the widgets in your home.php
cheers
Pinky
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.