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?

{ 23 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

coconutgoddess March 25, 2010 at 8:53 am

Worked perfectly.. thanks so much for sharing!

Aaron April 14, 2010 at 6:27 am

Thanks. This was exactly what I was looking for.

Steve Price June 4, 2010 at 4:25 am

Hello Adam,

Widgetizing Multimedia box worked, but when I tried to put in there the Next-gen gallery widget, the MM box doesn’t seem to work?

Please if you can, how will it work on the widgetized MM box?

Thank you,

Steve price

laura July 14, 2010 at 10:51 am

Thanks for the tutorial, it worked, now I’m just trying to figure out how to style it in CSS, would love some help to get me started, I’m a newbie ;)

Laura

Lars August 14, 2010 at 4:41 am

Great tuts. The only thing you need to take care of after adding this code is the css. The styling for the build in widgets is not picked up by the widgetized multimedia box. I added this to custom.css and ik look good now. Reason for adding the .sidebar h3 selector is to make sure I only have to update the styling in one location by overriding the font styling for the two build in widgets areas.

#custom_box {
font-size:1em;
line-height:1.538em;
}

div#multimedia_box h3, .sidebar h3 {
color:#555555;
font-size:1.3em;
line-height:1.385em;
margin-bottom:0.692em;
font-variant:small-caps;
letter-spacing:2px;
}

Sharron Clemons December 21, 2010 at 1:07 pm

Worked perfectly.. thanks so much for sharing!

Sharron Clemons December 21, 2010 at 1:13 pm

[...] or you can use “Custom Code” to really think outside of the box (ha). You can also widgetize it if you so [...]

Soccerwidow January 10, 2011 at 7:50 am

Sadly it doesn’t work with Thesis 1.8 and Wordpress 3.0.4

Rachael July 18, 2011 at 8:42 pm

Worked great for my nextgen slideshow! Thanks! :)

Rachael July 18, 2011 at 8:43 pm

Oh p.s. to Soccerwidow, not sure about 1.8 but I installed it on 1.82 and WordPress 3.2

Leave a Comment

{ 2 trackbacks }

Previous post:

Next post: