Widgetizing Thesis’ Multimedia Box

en Español: This page has been translated into Spanish by Maria Ramos from Webhostinghub.com.

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!

42 thoughts on “Widgetizing Thesis’ Multimedia Box”

  1. 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..

      1. 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.

  2. 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.php file, and add the code to the very end of the file. Should work fine, but let me know if it doesn’t.

  3. 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.

  4. 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?

  5. 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.

  6. 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?

  7. 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???

  8. Hey Rick,

    Wooo hoooo . . . Thanks again for your help. I got the widgetized multimedia box going. How easy & how cool!

  9. 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

  10. Rick
    Found it via FTP – added the additional lines – in Notepad++
    then uploaded it.
    In Appearance | Widgets – don’t see any change.
    Advice?
    Jon

  11. 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.

  12. 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.

  13. 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.

  14. 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

  15. 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.

  16. 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

  17. 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?

  18. Rick,
    Thanks! This is great. And I had just recently discovered Widget Logic which is fantastic. Is it possible to move the MM Box to the the left sidebar panel ?(using 3 columns on a site) – or any other place also? I’d love the flexibility of moving the box.
    Thanks!

  19. Yikes, Hi Rick this doesn’t seem to work for me.. :(

    The multimedia box looks good for the homepage, but when you click though to individual post pages, it shows the article image in its place of expected video for some reason.. So it looks like its not picking up the setting somehow.. Any idea where I can look? I want to use widget logic eventually..

  20. I think the article image takes precedent. Disable that on the individual articles and you’ll probably be fine. If that’s not the case, you’ll need to ask at Thesis support. I’ve not used the theme for several versions now, so it may not be behaving like I was used to anymore.

  21. Box is up and running just fine. I’m using an image widget. Is there a way to get some styling in there – font size, color, different headline font, padding between copy and image so I can move it to the left side of the widget? Thanks…

  22. You’d have to view the source of your page (or use Firebug to inspect it) so that you know exactly which elements/classes/IDs you want to target, then you could easily add whatever styling you want to your custom stylesheet targeting the aforementioned elements/classes/IDs. Because there is a theoretical infinite combination of answers due to every setup, every widget, and every customization being slightly different, I can’t really be more specific.

  23. I did this and when I went to Appearances and clicked on it I get this error message:

    Parse error: syntax error, unexpected $end in /home/potatot1/public_html/wp/wp-content/themes/thesis_181/thesis_181/custom/custom_functions.php on line 18

    I ran the script that I entered through an online php validator and it said there were no syntax errors. Line 18 (if I’m counting correctly) is just the closing bracket.

  24. Now when I go back to the Manage Themes page I’m getting this at the top of the page. Can’t seem to get rid of it.

    Warning: Cannot modify header information – headers already sent by (output started at /home/potatot1/public_html/wp/wp-content/themes/thesis_181/thesis_181/custom/custom_functions.php:1) in /home/potatot1/public_html/wp/wp-includes/functions.php on line 861

    Warning: Cannot modify header information – headers already sent by (output started at /home/potatot1/public_html/wp/wp-content/themes/thesis_181/thesis_181/custom/custom_functions.php:1) in /home/potatot1/public_html/wp/wp-includes/functions.php on line 862

  25. The error message indicates that something is being output to the browser by your custom functions file, and it’s outputting in the very first line of that file.

    Are you sure there is no extra space before the opening <php tag?

  26. Yes the opening tag is right up against the left side corner. I put the cursor there to make sure there’s no space.

    The worst thing is even though I have deleted the code I added, I’m still getting the error messages.

    This same kind of thing happened with another customization I tried to do. I ended up reinstalling everything. Replacing the edited php file with the original from the zip file didn’t help.

    I feel so stuck! Was just getting started with Thesis and can’t get anywhere.

  27. Hi Rick – thanks for the tip!

    I added the code successfully and now see the Multimedia box in my Widget area. Unfortunately it doesn’t appear to work, though. I can add any widget to the box in Multimedia Box, save it, but nothing happens to the page result. Thesis’ default images remain.

    I’m grateful for any help or guidance you can provide.

    Thanks, Scott

  28. Lol – oops, I missed a small, but very important step in the process – setting the custom code option in the multimedia box settings. Works great. Thanks sir!

  29. Hello
    I have a small question and be grateful if you could answer.

    I am using a header background, but since I moved the MM box up, the background stops where the mmbox starts. How to overcome this obstruction? Any ideas? Thanks.

  30. If the site in question is the one your name is linked to, you can get a more attractive result by adding this to your custom.css style sheet:

    #sidebars { margin-top: 1.3em; }
  31. Can’t get this to work.

    I get about a 20px high grey rectangle above the sidebars on the site but no Multimedia Box widget area on the widgets page – just the same old sidebars.

    Thesis 1.8.2 installed.

    Peter

Leave a Reply to Rick Beckman Cancel Reply

Your email address will not be published. Required fields are marked *

Use your Gravatar-enabled email address while commenting to automatically enhance your comment with some of Gravatar's open profile data.

Comments must be made in accordance with the comment policy. This site uses Akismet to reduce spam; learn how your comment data is processed.

You may use Markdown to format your comments; additionally, these HTML tags and attributes may be used: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.

the Rick Beckman archive
Scroll to Top