What better way to start my blogging blog than to share a tip for WordPress bloggers using the world’s best theme?
The subject of Thesis’ multimedia box comes up quite a bit on our support forums, with users wanting to do a variety of things in that area. (Honestly, I’m convinced that every theme needs a multimedia box akin to Thesis’; users are doing all sorts of amazing things with it!) One of the questions I haven’t been able to answer up to this point is how to widgetize the multimedia box area, allowing for far more customization without the need to write or even copy a single line of code.
The answer comes from one Adam Barber (@adambarber), and the solution was easier than I ever thought!
All that’s required is a simple addition to your custom_functions.php file:
register_sidebar(array('name' => 'Multimedia Box', 'before_widget' => '<li class="widget %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
function multimedia_box_widgets() {
echo '<ul class="sidebar_list">';
dynamic_sidebar('Multimedia Box');
echo '</ul>';
}
add_action('thesis_hook_multimedia_box', 'multimedia_box_widgets');
The first line registers our new “sidebar,” or widgetized area. We use the same options as used by Thesis’ default sidebars, but we name the area something meaningful for our purpose: “Multimedia Box.”
The third through seventh lines create the function which outputs our new widgetized area. Ordinarily, only the second through fourth of these three lines is needed, and it would be placed in the theme files where we want the widgets to appear. However, with Thesis, in order to facilitate the easiest possible upgrade experience, we prefer to keep all customizations within the custom/ folder, and we wrap the code we want to add within a function (or, action) which can then be hooked into the appropriate place within Thesis, which is what the final line of the code does.
Once you have added the code and uploaded the file to your remote Thesis custom/ folder, you will be able to select a new widgetized area in the Appearance » Widgets panel of your site. In the Appearance » Thesis Options panel, set your multimedia box to use “custom code.” That’s it!
Now, perhaps you want different items appearing on the multimedia box depending on which page you’re visiting; no problem! Because this is now a widgetized area, you can control it via the likes of the Widget Logic WordPress plugin!
Enhance Your Blog with Thesis
What do you look for in a WordPress theme? Loads of options? Unsurpassed support? A beautiful base style?
Look no further than Thesis, the premier WordPress theme framework from the one and only Chris Pearson.
Rock solid semantics. Bulletproof search engine optimization. Crystal clear typography. And more options than you can shake a stick at. What are you waiting for? Get Thesis today!



8 linkbacks
22 responses in this conversation. Join in!
I followed your instructions exactly and copied and pasted the code. When I add widgets to the mm box they show up ok but it repeats at the bottom of the sidebar. Any suggestions..
I does not work properly and I had errors. Pls advise
For that, I would need to know what errors you were receiving.
Is it still necessary to alter custom_functions.php for this if we are using your Open Hook? Excuse my ignorance, Rick, but you have created a fairly new reply to this thread, and you don’t mention Open Hook anywhere. If we can use Open Hook, we’d put the 2-4 lines, where? Multimedia box? Or, is it something you still have to alter the file manually to do? I’ve been unsuccessful with any customizations that require changes to custom_functions.php.
Also, I’ve been having lots of difficulty with customizations in general, even with Open Hook–everything results in a “parsing” error. I don’t know where I can post a general request for help with these errors–please point me in the right direction. There has to be a simple solution.
lavenedora: There’s an area for OpenHook support on the official DIYthemes support community, so feel free to seek help there.
However and unfortunately, the above code likely won’t work in OpenHook. The first line of the code must be active when the admin panel is called, and none of OpenHook’s boxes perform any action at all within the admin panel.
Open your
custom_functions.phpfile, and add the code to the very end of the file. Should work fine, but let me know if it doesn’t.Thanks, Rick. I’ll give it a try and let you know if there are any issues with plugging it directly into custom_functions.php.
For some reason the plugin isn’t working anymore. It was before. Even when I try and add an image through my custom_function file it doesn’t work. What do you think could be the issue?
t: Do you mean OpenHook isn’t working? If so, drop by the OpenHook support forum on the DIYthemes board and explain the situation — Thesis version, OpenHook version, the exact code you’re using, and so on. Thanks.
I went to the diy forums but didn’t see a forum for open hook support just a support for 1.5. Is that where I’m supposed to post it?
I found it but I can tell you here what’s going on…
I’m running 1.5 v7
I’m trying to create a box and place it with the plugin…
Here’s what I put in the after header
<div class="commentbox"></div>
Here’s what’s in my custom.css
.custom .commentbox {border: solid 1px; height: 50px; width: 300px; background: #eeeedd;}
Here’s the problem. It showed up fine, then i refreshed and it disappeared. Then I inserted the word "test" between the div tags. It showed up. Then I got rid of the word "test" and just inserted a "t" and the box disappeared again but the "t" showed up . Then I got rid of the "t" and nothing showed up again. Then i put the word "test" in there and just the word "test" shows with no box.
The box did show up once but I can’t get it back. Any suggestions???
Hey Rick,
Wooo hoooo . . . Thanks again for your help. I got the widgetized multimedia box going. How easy & how cool!
Rick,
In the Appearance | Editor window – I don’t have a custom_functions.php file – I do have “custom template” and “functions”
But not custom_functions
What am I missing here?
Jon
Rick
Found it via FTP – added the additional lines – in Notepad++
then uploaded it.
In Appearance | Widgets – don’t see any change.
Advice?
Jon
does this become sort of obsolete with the open hooks plug-in?
Not necessarily. OpenHook lets you easily add content to the Multimedia Box, but it still isn’t widgetized. If you want to easily add widgets to the multimedia box, then the tutorial is still relevant. Although, I’m not sure it even works these days. May have to revisit it when I have the time.
Using the MM Box Widget created with your simple, much appreciated coding, I would like to put different videos on different pages. How do I do that?
Thanks in advance.
If you’re going to accomplish that with widgets, then you’ll need to use a plugin like Widget Logic to control which widget appears on which page, then add numerous Text widgets, each with the code to display a different video. Each widget can then be set to display in a different context using Widget Logic’s controls.
Ah so!
Thank you for the quick reply…and for all of the work that you do!
OMG I messed up. I was trying to create a custom 404 page and changed the custom_functions.php page and now I cannot get back into it on the site!!!
Please HELP!!
Thanks,,
Tina
Remove the code you added to the file. Replace it with an entirely blank file if you have to; there’s likely a syntax error in your code that you’ll need to track down before you’ll be able to use the code on your site.
For further help, ask on the Thesis support board. Thanks.
Thank you Rick! I actually did get into the ftp area and accessed the file; removed what I added and it is acting better. At least I am able to log back into the admin pane/dashboard, but I keep getting other weird errors that I can only chalk up to this mistake. I did save the originally customized php file with an extension and will always have that now if needed.
I appreciate your time; thanks again.
Tina
ich have successfully widgetized the multimedia box. Thanks Rick!
But if i put a widget like Killer Recent Entries in it, then this widget got no styling like the other widgets in the sidebar.
How can i set up the styling for this Multimedia Box Widget?