Widgetizing Thesis’ Multimedia Box

en Español: This page has been trans­lat­ed into Span­ish by Maria Ramos from Webhostinghub.com.

What bet­ter way to start my blog­ging blog than to share a tip for Word­Press blog­gers using the world’s best theme?

The sub­ject of The­sis’ mul­ti­me­dia box comes up quite a bit on our sup­port forums, with users want­i­ng to do a vari­ety of things in that area. (Hon­est­ly, I’m con­vinced that every theme needs a mul­ti­me­dia box akin to The­sis’; users are doing all sorts of amaz­ing things with it!) One of the ques­tions I haven’t been able to answer up to this point is how to wid­getize the mul­ti­me­dia box area, allow­ing for far more cus­tomiza­tion with­out the need to write or even copy a sin­gle line of code.

The answer comes from one Adam Bar­ber (@adambarber), and the solu­tion was eas­i­er than I ever thought! 

All that’s required is a sim­ple addi­tion 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 reg­is­ters our new “side­bar,” or wid­getized area. We use the same options as used by The­sis’ default side­bars, but we name the area some­thing mean­ing­ful for our pur­pose: “Mul­ti­me­dia Box.”

The third through sev­enth lines cre­ate the func­tion which out­puts our new wid­getized area. Ordi­nar­i­ly, only the sec­ond through fourth of these three lines is need­ed, and it would be placed in the theme files where we want the wid­gets to appear. How­ev­er, with The­sis, in order to facil­i­tate the eas­i­est pos­si­ble upgrade expe­ri­ence, we pre­fer to keep all cus­tomiza­tions with­in the custom/ fold­er, and we wrap the code we want to add with­in a func­tion (or, action) which can then be hooked into the appro­pri­ate place with­in The­sis, which is what the final line of the code does.

Once you have added the code and uploaded the file to your remote The­sis custom/ fold­er, you will be able to select a new wid­getized area in the Appear­ance » Wid­gets pan­el of your site. In the Appear­ance » The­sis Options pan­el, set your mul­ti­me­dia box to use “cus­tom code.” That’s it!

Now, per­haps you want dif­fer­ent items appear­ing on the mul­ti­me­dia box depend­ing on which page you’re vis­it­ing; no prob­lem! Because this is now a wid­getized area, you can con­trol it via the likes of the Wid­get Log­ic Word­Press plugin!

42 thoughts on “Widgetizing Thesis’ Multimedia Box”

  1. I fol­lowed your instruc­tions exact­ly and copied and past­ed the code. When I add wid­gets to the mm box they show up ok but it repeats at the bot­tom of the side­bar. Any suggestions..

      1. Is it still nec­es­sary to alter custom_functions.php for this if we are using your Open Hook? Excuse my igno­rance, Rick, but you have cre­at­ed a fair­ly new reply to this thread, and you don’t men­tion Open Hook any­where. If we can use Open Hook, we’d put the 2–4 lines, where? Mul­ti­me­dia box? Or, is it some­thing you still have to alter the file man­u­al­ly to do? I’ve been unsuc­cess­ful with any cus­tomiza­tions that require changes to custom_functions.php.

        Also, I’ve been hav­ing lots of dif­fi­cul­ty with cus­tomiza­tions in gen­er­al, even with Open Hook–everything results in a “pars­ing” error. I don’t know where I can post a gen­er­al request for help with these errors–please point me in the right direc­tion. There has to be a sim­ple solution.

  2. lavene­do­ra: There’s an area for Open­Hook sup­port on the offi­cial DIYthemes sup­port com­mu­ni­ty, so feel free to seek help there.

    How­ev­er and unfor­tu­nate­ly, the above code like­ly won’t work in Open­Hook. The first line of the code must be active when the admin pan­el is called, and none of Open­Hook’s box­es per­form any action at all with­in 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 plug­ging it direct­ly into custom_functions.php.

  4. For some rea­son the plu­g­in isn’t work­ing any­more. It was before. Even when I try and add an image through my custom_function file it does­n’t work. What do you think could be the issue?

  5. t: Do you mean Open­Hook isn’t work­ing? If so, drop by the Open­Hook sup­port forum on the DIYthemes board and explain the sit­u­a­tion — The­sis ver­sion, Open­Hook ver­sion, the exact code you’re using, and so on. Thanks.

  6. I went to the diy forums but did­n’t see a forum for open hook sup­port just a sup­port for 1.5. Is that where I’m sup­posed to post it?

  7. I found it but I can tell you here what’s going on…

    I’m run­ning 1.5 v7

    I’m try­ing to cre­ate 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

    .cus­tom .com­ment­box {bor­der: sol­id 1px; height: 50px; width: 300px; back­ground: #eeeedd;}

    Here’s the prob­lem. It showed up fine, then i refreshed and it dis­ap­peared. Then I insert­ed the word “test” between the div tags. It showed up. Then I got rid of the word “test” and just insert­ed a “t” and the box dis­ap­peared again but the “t” showed up . Then I got rid of the “t” and noth­ing 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 wid­getized mul­ti­me­dia box going. How easy & how cool!

  9. Rick,
    In the Appear­ance | Edi­tor win­dow — I don’t have a custom_functions.php file — I do have “cus­tom tem­plate” and “func­tions”
    But not custom_functions
    What am I miss­ing here?

  10. Rick
    Found it via FTP — added the addi­tion­al lines — in Notepad++
    then uploaded it.
    In Appear­ance | Wid­gets — don’t see any change.

  11. Not nec­es­sar­i­ly. Open­Hook lets you eas­i­ly add con­tent to the Mul­ti­me­dia Box, but it still isn’t wid­getized. If you want to eas­i­ly add wid­gets to the mul­ti­me­dia box, then the tuto­r­i­al is still rel­e­vant. Although, I’m not sure it even works these days. May have to revis­it it when I have the time.

  12. Using the MM Box Wid­get cre­at­ed with your sim­ple, much appre­ci­at­ed cod­ing, I would like to put dif­fer­ent videos on dif­fer­ent pages. How do I do that?

    Thanks in advance.

  13. If you’re going to accom­plish that with wid­gets, then you’ll need to use a plu­g­in like Wid­get Log­ic to con­trol which wid­get appears on which page, then add numer­ous Text wid­gets, each with the code to dis­play a dif­fer­ent video. Each wid­get can then be set to dis­play in a dif­fer­ent con­text using Wid­get Log­ic’s controls.

  14. OMG I messed up. I was try­ing to cre­ate a cus­tom 404 page and changed the custom_functions.php page and now I can­not get back into it on the site!!!

    Please HELP!!



  15. Remove the code you added to the file. Replace it with an entire­ly blank file if you have to; there’s like­ly a syn­tax error in your code that you’ll need to track down before you’ll be able to use the code on your site.

    For fur­ther help, ask on the The­sis sup­port board. Thanks.

  16. Thank you Rick! I actu­al­ly did get into the ftp area and accessed the file; removed what I added and it is act­ing bet­ter. At least I am able to log back into the admin pane/dashboard, but I keep get­ting oth­er weird errors that I can only chalk up to this mis­take. I did save the orig­i­nal­ly cus­tomized php file with an exten­sion and will always have that now if needed. 

    I appre­ci­ate your time; thanks again.


  17. ich have suc­cess­ful­ly wid­getized the mul­ti­me­dia box. Thanks Rick!
    But if i put a wid­get like Killer Recent Entries in it, then this wid­get got no styling like the oth­er wid­gets in the sidebar.
    How can i set up the styling for this Mul­ti­me­dia Box Widget?

  18. Rick,
    Thanks! This is great. And I had just recent­ly dis­cov­ered Wid­get Log­ic which is fan­tas­tic. Is it pos­si­ble to move the MM Box to the the left side­bar pan­el ?(using 3 columns on a site) — or any oth­er place also? I’d love the flex­i­bil­i­ty of mov­ing the box.

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

    The mul­ti­me­dia box looks good for the home­page, but when you click though to indi­vid­ual post pages, it shows the arti­cle image in its place of expect­ed video for some rea­son.. So it looks like its not pick­ing up the set­ting some­how.. Any idea where I can look? I want to use wid­get log­ic eventually..

  20. I think the arti­cle image takes prece­dent. Dis­able that on the indi­vid­ual arti­cles and you’ll prob­a­bly be fine. If that’s not the case, you’ll need to ask at The­sis sup­port. I’ve not used the theme for sev­er­al ver­sions now, so it may not be behav­ing like I was used to anymore.

  21. Box is up and run­ning just fine. I’m using an image wid­get. Is there a way to get some styling in there — font size, col­or, dif­fer­ent head­line font, padding between copy and image so I can move it to the left side of the wid­get? Thanks…

  22. You’d have to view the source of your page (or use Fire­bug to inspect it) so that you know exact­ly which elements/classes/IDs you want to tar­get, then you could eas­i­ly add what­ev­er styling you want to your cus­tom stylesheet tar­get­ing the afore­men­tioned elements/classes/IDs. Because there is a the­o­ret­i­cal infi­nite com­bi­na­tion of answers due to every set­up, every wid­get, and every cus­tomiza­tion being slight­ly dif­fer­ent, I can’t real­ly be more specific.

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

    Parse error: syn­tax error, unex­pect­ed $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 val­ida­tor and it said there were no syn­tax errors. Line 18 (if I’m count­ing cor­rect­ly) is just the clos­ing bracket.

  24. Now when I go back to the Man­age Themes page I’m get­ting this at the top of the page. Can’t seem to get rid of it. 

    Warn­ing: Can­not mod­i­fy head­er infor­ma­tion — head­ers already sent by (out­put start­ed 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

    Warn­ing: Can­not mod­i­fy head­er infor­ma­tion — head­ers already sent by (out­put start­ed 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 mes­sage indi­cates that some­thing is being out­put to the brows­er by your cus­tom func­tions file, and it’s out­putting in the very first line of that file.

    Are you sure there is no extra space before the open­ing <php tag?

  26. Yes the open­ing tag is right up against the left side cor­ner. I put the cur­sor there to make sure there’s no space.

    The worst thing is even though I have delet­ed the code I added, I’m still get­ting the error messages.

    This same kind of thing hap­pened with anoth­er cus­tomiza­tion I tried to do. I end­ed up rein­stalling every­thing. Replac­ing the edit­ed php file with the orig­i­nal from the zip file did­n’t help.

    I feel so stuck! Was just get­ting start­ed with The­sis and can’t get anywhere.

  27. Rick, thanks so much for your email help!! I’m feel­ing a lot less dis­cour­aged now…:-)


  28. I’m glad you got every­thing up and run­ning again, tori. I’m also sur­prised my code above that you used still works. It’s over two years old!

  29. Hi Rick — thanks for the tip!

    I added the code suc­cess­ful­ly and now see the Mul­ti­me­dia box in my Wid­get area. Unfor­tu­nate­ly it does­n’t appear to work, though. I can add any wid­get to the box in Mul­ti­me­dia Box, save it, but noth­ing hap­pens to the page result. The­sis’ default images remain.

    I’m grate­ful for any help or guid­ance you can provide.

    Thanks, Scott

  30. Lol — oops, I missed a small, but very impor­tant step in the process — set­ting the cus­tom code option in the mul­ti­me­dia box set­tings. Works great. Thanks sir!

  31. Hel­lo
    I have a small ques­tion and be grate­ful if you could answer.

    I am using a head­er back­ground, but since I moved the MM box up, the back­ground stops where the mmbox starts. How to over­come this obstruc­tion? Any ideas? Thanks.

  32. If the site in ques­tion is the one your name is linked to, you can get a more attrac­tive result by adding this to your custom.css style sheet:

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

    I get about a 20px high grey rec­tan­gle above the side­bars on the site but no Mul­ti­me­dia Box wid­get area on the wid­gets page — just the same old sidebars.

    The­sis 1.8.2 installed.


Leave a Comment

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>

Rick Beckman