Create widget areas within a sidebar

Community Forums Forums Design Tips and Tricks Create widget areas within a sidebar

This topic is: not resolved

Tagged: ,

This topic contains 1 reply, has 2 voices, and was last updated by  Pinky 1 year, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #23373

    TravisPri
    Participant
    Post count: 29

    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!

    #27300

    Pinky
    Participant
    Post count: 93

    I 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

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.