Dividing widgets in sidebar?

I’m having a custom sidebar called Footer. I’m displaying this sidebar using this code:

<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer') ) : ?>  
    (maybe I should do something in this line?) :)
<?php endif; ?>  

This works smoothly, but almost every theme nowadays allow users to place their widgets in columns, just like there:

Read More

http://kaptinlin.com/themes/striking/

My markup looks like:

<footer>
   <li id="plugin-name" class="widget widget_name">[widget]</li>
   <li id="plugin-name" class="widget widget_name">[widget]</li>
   <li id="plugin-name" class="widget widget_name">[widget]</li>
</footer>

And I want it to look like:

<footer>
   <div id="column_1">
     <li id="plugin-name" class="widget widget_name">[widget]</li>
   </div>
   <div id="column_2">
      <li id="plugin-name" class="widget widget_name">[widget]</li>
   </div>
</footer>

How to achieve that? (btw I don’t want to give width/height to my plugins, I want to create containers for them only)

I don’t know what plugins will user activate so I’m not able to use direct plugin linking. I have to grab 1st plugin, 2nd plugin, 3rd plugin etc., but I see no code allowing me to in Codex.

Related posts

Leave a Reply

2 comments

  1. You would achieve that when you first registered your sidebar within your functions.php file.

        <?php $args = array(
        'name'          => sprintf(__('Sidebar %d'), $i ),
        'id'            => 'sidebar-$i',
        'description'   => '',
        'before_widget' => '<div id="column_%1$s"><li id="%2$s" class="widget %2$s">',
        'after_widget'  => '</li></div>',
        'before_title'  => '',
        'after_title'   => '' ); ?>
    

    What this is going to do is create that wrapper for each widget that you wanted. Just call a single dynamic_sidebar call and wordpress will do the rest.