Welcome to AdamBarber.tv

To request a quote, please call Adam at (856) 438-0002

Widgetize the Thesis Media Box!

by adam on June 26, 2009

Have you ever wanted to be able to quickly modify the Thesis media box, and turn it into a widget-ready area? The tutorial below outlines the steps you need to take to make that happen. This is especially useful if you use NextGen Gallery and want to be able to display random image from the gallery, directly in the media box.

Step 1 - Open your custom_functions.php file and add the following.

1
2
3
4
5
6
7
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name'=>'Media Box',
'before_widget' => '<li class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h3>',
'after_title' => '</h3>'));

Step 2While still in custom_functions.php add this.

1
2
3
4
5
6
7
8
function mediabox_widget() {
echo '<ul class="sidebar_list">';
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Media Box') ) :
echo '</ul>';
 
endif;
}
add_action('thesis_hook_multimedia_box', 'mediabox_widget');

Step 3 - Enable “custom code” for the media box, under the Thesis Options admin panel.

Step 4 - Go to the widgets admin area, select “Media Box” and add your widgets.

That’s it! Easy, right?

Popularity: 59% [?]

{ 13 comments… read them below or add one }

Kelly Carter August 3, 2009 at 2:10 pm

Does this work with Thesis 1.5.1? I can’t get it to show up on my (test) site. Step 3 above doesn’t work, as the Media Box doesn’t show up in the Thesis Options admin panel. Step 4 seems to work OK, however.

A similar widget from rickbeckman.org fails in the same way: seems to set up but not show up. Maybe Thesis 1.5.1 has a conflict?

Bert Mahoney August 27, 2009 at 1:10 am

Hi Kelly,
I followed this tut tonight and worked flawlessly. However, check where you are looking for the Multimedia Box Options. Its on the “Design Options” panel and not the “Thesis Options” panel.
Adam, you may want to update that info.
Hope this helps.
-Berchman
http://www.berchman.com

Kelli September 4, 2009 at 8:38 pm

I’m just starting to build this site, (www.theposhfrog.com) and can’t seem to get it to work either….

Kelli September 6, 2009 at 8:23 pm

Berchman,

Can you take a look at my site and tell me why it’s not working? I’ve gone back through and can’t figure it out. The tutorial is straight-forward, I just must be doing something not quite right!

Thanks in advance!

-Kelli
http://www.theposhfrog.com

Jonas September 19, 2009 at 3:38 pm

Hey Adam — I just tried to insert this into my custom.php folder at it crashed it — says there was some invalid code in there, so I had to go back and strip it out again to get my site back up. I don’t know why this is (just posted something about it on the Thesis forum in fact) but figured I’d let you know just in case it’s not something on my end…

Yevgen Telychko October 3, 2009 at 6:16 pm

This solution should work just fine. For those who encountered any problems, you might have forgotten to rename the folder where custom_functions.php is located from “custom-sample” to “custom”. It is necessary to activate custom functions in Thesis.

Monique November 6, 2009 at 1:54 am

Thanks for the tut/code, but what would this be good to use for? I’m new to Thesis and blogging and not sure what this would come in handy for. Thanks!

Simon December 29, 2009 at 3:20 am

This is exactly what I was looking for… worked perfectly, thanks!

Jaume Garcia January 25, 2010 at 6:05 pm

Thanks for sharing!! It works great in wp 2.9.1 and Thesis 1.6.
Thanks a lot
Bye

Justin January 28, 2010 at 9:06 am

Thanks for the howto! I’m using thesis for the first time on a clients site. Plan on using it for my sites also. It’s so easy to use makes me wonder why I have waited this long.

Dan February 16, 2010 at 6:35 pm

If you’re copying directly from above, a tab may get inserted causing an error. You’ll get an unexpected & at line 44. I just escaped it and it worked. Haven’t tried just removing yet.

Kayle Simon February 17, 2010 at 10:59 pm

Thanks for this. I put a post excerpt with photo into my box, loving that, at http://74.53.42.62/~admin/ Now I am hoping I can figure out how to rotate them or make a different one appear on each page of the site; have you been asked about how to make this work in either of those ways? I suppose one could add an “if is home” to the php, and then end up with mm widget areas for several different pages, perhaps…

adam February 19, 2010 at 10:48 am

I think you might want to try using the widget-me subframework. Using that in conjuncition with the code from this post should do the trick. Let me know how it works out for you -Adam

Leave a Comment

Previous post:

Next post: