3

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.

4
  • 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, 2012 at 13:45
  • 1
    agree this would be very neat. Jul 19, 2012 at 14:11
  • 1
    +1 But please explain, what "media related"-Widgets are. Thanks.
    – kaiser
    Jul 19, 2012 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, 2012 at 20:32

2 Answers 2

0

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.

9
  • 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!
    – Androliyah
    Jul 23, 2012 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, 2012 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.
    – Androliyah
    Jul 23, 2012 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, 2012 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).
    – Androliyah
    Jul 24, 2012 at 17:38
0

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' => '',
));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.