Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am wondering if it is possible to create other Widget Holding sections like Active Widgets and Inactive Widgets. For instance, perhaps I would create a Media Widgets section and place all media related widgets in there.

Is this possible? If so, how could I create the section and how would I place the widgets in there?

Thanks.

share|improve this question
1  
Very good Question! But also afraid that the Answer may be: no. Put your bets on the table, Ladies and Gents..! –  brasofilo Jul 19 '12 at 13:45
1  
agree this would be very neat. –  helgatheviking Jul 19 '12 at 14:11
1  
+1 But please explain, what "media related"-Widgets are. Thanks. –  kaiser Jul 19 '12 at 15:00
    
I was just using media as a made up example. The point is that I would like to categorize widgets into logical groups. For instance, I could have Social Media related Widgets (Twitter, RSS feeds, etc.), link related widgets (Links, Menu Items, etc.) –  user15927 Jul 19 '12 at 20:32

2 Answers 2

up vote 0 down vote accepted

enter image description here

Probably isn't considered "best practices" but it gets the job done.

Here's what I did: In my wp-admin/widgets.php,

After these lines,

// register the inactive_widgets area as sidebar
register_sidebar(array(
    'name' => __('Inactive Widgets'),
    'id' => 'wp_inactive_widgets',
    'class' => 'inactive-sidebar',
    'description' => __( 'Drag widgets here to remove them from the sidebar but keep their settings.' ),
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '',
    'after_title' => '',
));

add this

register_sidebar(array(
    'name' => __('Media Widgets'),
    'id' => 'wp_inactive_widgets2',
    'class' => 'inactive-sidebars2',
    'description' => __( 'Drag widgets here to remove them from the sidebar but keep        their settings.' ),
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '',
    'after_title' => '',
));

When you add your widgets to the new holder, they'll display all the way across like in my pic. Perhaps because no styling was done to this new holder. Anyway this is working for me, I logged out and back in and my widgets are still there.

As always, when changing themes, your "Media Widgets" will be moved to the "Inactive" holder if the new theme doesnt have the same sidebar setup as the previous one.

share|improve this answer
    
To be honest, I'm proud of myself for even attempting to answer this question. I took a shot in the dark and made a new discovery myself! –  Aliyah Jul 23 '12 at 10:40
    
That's what I was looking for - thanks. Any idea, though, how to make this change via the functions.php file? –  user15927 Jul 23 '12 at 19:34
    
Hmm..To copy all of that code from widgets.php to functions.php seems tedious. I could be wrong, but the admin widgets dont work the same as theme widgets. Lot more going on in widgets.php, from what I see. (looked in both files just now). I've given, probably, the easiest solution. Sorry, haven't tried to add anything to functions, maybe someone else will but an upvote would be nice if my answer helped you at all. Thanx. –  Aliyah Jul 23 '12 at 20:31
    
The point of using the functions.php file is so that I don't interact directly with the core files. Either way, it's a good first step (and I added an upvote as a result) - thanks. –  user15927 Jul 24 '12 at 8:28
    
I understand. I wish I knew how to do it in functions too. The good thing about this is it isnt a serious change in core. Just an extra widget in the widgets.php file. I'll try to figure out a way to do it from functions but the setup is completely different. Glad I could help :) By the way, unless you're waiting for another answer, you can mark this one as accepted, since It does, in fact, answer your initial question (your initial question doesnt include functions.php). –  Aliyah Jul 24 '12 at 17:38

No need to hack the WordPress core for that, on your functions.php theme file, put this:

// register the inactive_widgets area as sidebar
register_sidebar(array(
    'name' => __('Inactive Widgets 2'),
    'id' => 'wp_inactive_widgets_2',
    'class' => 'inactive-sidebar',
    'description' => __( 'Drag widgets here to remove them from the sidebar but keep their settings.' ),
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '',
    'after_title' => '',
));
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.