Widgetize Anything

November 30, 2006 By: erik Category: Wordpress 36,474 views

Rate this post:
1 Star2 Stars3 Stars4 Stars5 Stars (42 votes, average: 4.67 out of 5)
Loading...Loading...
As of WordPress 2.8.2, this plugin no longer works. I recommend switching to use the PHP Code Widget. It’s exactly the same as this one, except that it requires you to use <?php and ?> tags.

There are many WordPress plugins that should be converted into sidebar widgets, made compatible with the Automattic Widget Plugin, but, for whatever reason, have not yet been converted. Wouldn’t it be nice if there were a generic way to call other plugins from within a sidebar widget? Now there is! Introducing…. Widgetize Anything!

Basically, it works just like the built-in text widgets, except that it allows you to put in PHP code into the body of the widget.

widgetize-anything.tar.gz

widgetize-anything.zip

Features

  • Create any number of Widgetize Anything widgets
  • Paste PHP code directly into the widgets in the widget admin
  • Built in optional “Title” property.

Requirements

Installation

  1. Download the plugin here: widgetize-anything.tar.gz (2.3 kB)
  2. Unzip the plugin into your /wp-content/plugins directory.
  3. Activate the plugin in your WordPress admin.
  4. Choose how many Widgetize Anything widgets you want under Options –> Widgetize Anything (see screenshots)
  5. Enter the desired PHP code into the widget on the Sidebar Widgets page in your WordPress admin (see screenshots).
  6. Drag the widget onto the sidebar where you want it on the Sidebar Widgets page in your WordPress admin.

Screenshots

Widgetize Anything Options

The options screen

Hello World

The simplest example: Hello World

Highest Rated

Calling the WP-PostRatings plugin to display the highest-rated posts.

Troubleshooting

It’s important to understand that the code that you put into your widget must be valid PHP code. You may not open or close PHP blocks with “< ?php” or “?>”, nor can you place straight HTML code into the widget content. You have to echo out all the HTML code that you want to show up on your page.

Change History

1.2 2007-06-25 Fixed a bug caused by WordPress 2.2.1. They changed the way widgets are registered once again.
1.1 2007-05-17 Fixed a bug caused by WordPress 2.2. For 2.2, they incorporated the sidebar widgets plugin into the main codebase, and a few things changed.
1.0 2006-10-24 Original version

Questions and Comments

You may leave questions and comments on this blog, or email them directly to me at erikwordpressplugins -at- gmail.

 
  • Pingback:   WordPress Plugin: Widgetize Anything by Blogging Pro

  • Pingback: Wigetize Anything Plugin · Wordpress Workshop

  • Pingback: Wordpress Widgetizer on iface thoughts

  • Pingback: Code Widgetizer at Just Ducky

  • Pingback: BloggingPro China » WordPress Plugin: Widgetize Anything

  • Pingback: Full(o)bloG » Blog Archive » Cosa manca alla template?

  • Pingback: Emerging Tools and Technologies » Plugin: Widgetize Anything

  • Pingback: WP???????Widgetize Anything

  • Pingback: BLOGIK » Blog Archiv » Es ist vollbracht

  • Pingback: sein » Blog Archive » wordpress ???????

  • Mikrosenshi

    Wow, thanks for this great plugin Erik, it works like a charm. :)
    Installation was easy (WP 2.1.2) on my local test system. Hope it works even smooth when my page goes online. :D

    greets
    Mikrosenshi

  • gestroud

    Rats! Just upgraded to WP 2.2 and it messed up this great plugin. :-((

    I get this message now:

    Warning: Missing argument 2 for widgetize_anything() in /xxxx/xx/xxxxxx/xx/xx/wp-content/plugins/widgetize-anything/widgetize-anything.php on line 15

    What should I do to fix it?

    Thank,

    gestroud

  • http://www.erik-rasmussen.com/ erik

    gestroud: Thanks for letting me know. I’ve upgraded my blog and fixed the plugin. Just re-download it and it should work fine.

    It’s version 1.1 now. Yay!

  • gestroud

    Excellent!! Thank you, Erik! :)

  • anthabax

    hello..can you help me please
    i really dont know how to use echo strings
    i just copy paste this thing

    and error occured
    can u help me how to make this under echo strings
    sorry i really dont know about php
    thanks!!

  • http://www.erik-rasmussen.com/ erik

    anthabax: I’m sorry, but this plugin really does require a very basic knowledge of PHP. Any code that you can get to work directly in a php file (inside <?php ?> tags!) will work in a Widgetize Anything widget.

    Practice with a file, like your header.php, and then, once you get it working, paste that code into your widget. There are thousands of PHP tutorials out there. This page is not one of them.

    Good luck!

  • http://www.bui4ever.com Richard Bui

    Is it possible to make this MU compatible? Great plugin BTW!

  • http://www.erik-rasmussen.com/ erik

    Is it possible to make this MU compatible? Great plugin BTW!

    Probably. I assume it would just be a matter of accessing the “options” values for the plugin a little differently. Unfortunately, I have little interest in MU myself. But if someone else wanted to modify the plugin for dual compatibility, I’d accept the fix.

    I honestly suspect that the final destiny of this plugin is to be incorporated into the main WordPress codebase. It’s such a simple and universally useful idea. Now that widgets have been made standard in version 2.2, I don’t think it will take long for them to allow PHP in widget code.

  • http://www.tsaiberspace.net/ Rob

    The current download of the ZIP file is not correct for wordpress-2.2; there is no longer a need to check for ‘wp_register_sidebar_widget’ (no need for the extra “null” argument).

  • gestroud

    I think I’m gonna stop upgrading WP. Under the latest version, 2.2.1 none of the widgetize anything panels appear. Or I shoud say that they appear, but they are empty and the titles don’t show up. :-(

  • animator

    Widgetize anything is not working with 2.2.1 for me too.
    I posted a support ticket to wordpress.org and their answer was to change plugin!!!

    See for yourselves: Problems with 2.2.1 and Widgetize Anything

    Widgetize anything is a very good plugin and we need it functional on WP 2.2.1

    Please fix the problem

    Thanks

  • http://www.erik-rasmussen.com/ erik

    Sorry, guys, I was out of town for a few days.

    This has been fixed. Redownload version 1.2. They keep changing the way widgets are registered.

    I don’t know if version 1.2 is compatible with previous versions of WordPress.

  • http://www.bui4ever.com Richard Bui

    I can confirm the latest version works with WordPress MU 1.2.3. Thanks Erik for this great plugin!

  • gestroud

    Erik,

    Thank you for the diligence you pay in keeping this plugin updated. Much appreciated.

    gestroud

  • animator

    Thank you Erik for keeping this plugin updated

    It works like a charm with 2.2.1 :)

  • http://www.techbangalore.com prashanth

    Hi Erik,
    I got following error when tried 2 use it.
    I tried two widgets & got same error in both.

    Parse error: syntax error, unexpected ‘

  • http://www.erik-rasmussen.com/ erik

    prashanth: It’s probably a problem in your PHP code. Do two things:

    1) verify that the ‘hello world’ example in the post above works.
    2) verify that the exact php code you have in the widget body works in a regular php file inside the php tags.

    If #1 works and #2 doesn’t, then it’s a problem on your end, and you’ve got unmatching quotes in your PHP code. But if #2 works and #1 doesn’t, then it’s a problem with the plugin and you should let me know.

    Cheers,
    Erik

  • marcus

    Hello Erik,
    Thanks a lot for releasing such an excellent plugin like this. I have tried using your widget with the latest version of WordPress (2.2.1). Everything works fine, except that I can have only one instance of “Widgetize Anything” widget. I would like to have more than one instance like the text widget. Can you please tell me what to do?
    Regards

  • marcus

    I found the option. It would have really good if it was displayed right below the widgets, like the text and rss widget options.
    Thanks

  • http://www.erik-rasmussen.com/ erik

    Yes, that would be nice, but I don’t think it’s possible to modify that page. Or if it is, I don’t know how. Glad you found the solution, though.

  • http://www.henriksjoholm.se Henrik

    Thanks for this great plugin. However, even though I’ve downloaded the new version several times, WP still reports v. 1.1 when I install it and it doesn’t work in 2.2.1. Any suggestions what to do?

  • http://www.erik-rasmussen.com/ erik

    Henrik: The version number thing was because I’m and idiot and forgot to change it. If you redownload it, it should say 1.2. Can you explain exactly how it “doesn’t work” in 2.2.1? Can you enable the plugin? Does it show up in the widget admin? Can you add them to the sidebar?

  • http://www.henriksjoholm.se Henrik

    Wow! You really respond quickly…

    BTW, WP still claims it’s v 1.1, but that doesn’t really matter. Anyway, I can install the plugin without any difficulties and the settings from v 1.1 remain in place, as does the number of WA widgets:

    However, on the blog, none of the contents of the widgets show up (capture of part of the sidebar section):

    In the widgets, I use the following calls to plugins:
    #1: get_random_posts
    #2: InSeries::SeriesList
    #3: c2c_get_recent_posts
    #5: c2s_get_recent_posts

    Again, thanks for your awesome work (which I rely heavily on for my blogging, as you can see…)

  • http://www.erik-rasmussen.com/ erik

    No errors? Just no content?

  • http://www.henriksjoholm.se Henrik

    All the sudden, it started working again, now that I tried a couple of hours later. Weird… But that’s exactly what happened – no errors, but no content and when looking at the source, the markers (the insertion comment) were there.

    Anyway, thanks for looking into it and sorry for the inconvenience. Guess it’s a while before I understand how WP works…

  • http://www.erik-rasmussen.com/ erik

    Maybe you hadn’t hit “Save Changes” in the WP admin? I can see how it wouldn’t be immediately obvious to a first time WP users that you had to click that button.

    Anyway, glad it’s working. I really fixed the version number now. I swear! I had only fixed the .tar.gz version at my last comment, but now it’s right in the .zip.

  • a guy

    javascript:alert(xss);

  • http://POZlife Tony

    I am code stupid….anyone got a quick cut and paste for ad rotator? Need more than the 9 they give you!

    Thanks

  • Galileo

    Hola, ¿el plugin es compatible con las versiones actuales de wp?.

    Gracias

  • http://www.erik-rasmussen.com/ erik

    Galileo, sí. Lo estoy usando yo ahora mismo con 2.2.1. Todavía no he probado con 2.3.

  • S. Lynch

    Great Plugin!
    Is there a fix on the way for WordPress 2.3?
    Thanks.

  • http://www.erik-rasmussen.com/ erik

    It works fine in 2.3. I just upgraded and my sidebar is using it right now.

  • S. Lynch

    I get this with just text:

    Parse error: syntax error, unexpected T_STRING in /home/xxxxx/public_html/wp-content/plugins/widgetize-anything/widgetize-anything.php(31) : eval()’d code on line 1

    I think I get some other error with php in the box. Everthing worked fine until the 2.3 uprgrade.

    Thanks.

  • http://www.erik-rasmussen.com/ erik

    Lynch: That error means that some part of the PHP that you’re putting into the widget doesn’t work. Try pasting it temporarily into an actual PHP file, like your header.php and see if it works properly. I suspect that you’re calling some WP function that no longer exists or has changed somehow. I hope this helps..

  • S. Lynch

    Yes. It was the PHP. Sorry for the bother. Thanks for the help.

  • http://www.php-learn-it.com Learn PHP

    excellent post. thansk for sharing.

  • http://vitamea.hedlit.com/ Dennis

    There’s a problem with the Options – Widgetize Anything feature. When I’m in the admin section, and I click on Options -> Widgetize Anything, I get a 404 error. Is it a problem with 2.3?

  • http://www.eaglevalleyblog.com Caroline

    I get the following parse error using WP 2.3 (taken from source code)

    Parse error: parse error in /Library/WebServer/Documents/wordpress/wp-content/plugins/widgetize-anything/widgetize-anything.php(31) : eval()’d code on line 1

    This only occurs after I try to render the widget in a browser, other than that, the plugin functions. I have the following php code in my widget, replacing the first ? with a *:

    */

    Thanks for help in advance.

  • http://POZlife Tony

    Love this idea, but bad with code! Anyone have a cut and paste for me of the ad rotator code?

    Thnax
    Tony

  • Giun

    Hi,great plugin!

    Anyway to label the widgets differently than besides “widgetize Anything 1″?

  • http://www.erik-rasmussen.com/ Erik R.

    Giun, no, there isn’t really, I’m afraid. That annoys me too. It would have to be done on the screen where you choose how many to have.

  • Joseph

    Caroline, if you haven’t figured it out yet. I got the same problem when i used a php code when i have the php tag inside the widget as

    so all you need to do is not put the php tags – that worked for me ..good luck!

  • http://www.apadmedia.com apad

    Nice plugin. Now i can create several plugin in a sec!

  • http://urlredacted music

    very interesting.
    i’m adding in RSS Reader

  • jimbabwe

    Excellent!
    I’m using this html to php converter online:
    http://www.andrewdavidson.com/convert-html-to-php/
    Then I paste it into the widget.
    Easy way to get snippets into php!

    Thanks!

  • http://www.yangtown.com Ryan

    Thanks for the plugin, works great. I had a little trouble learning how to call the echo part for a php function, so for those newbies just call this in the widget: echo function_name();

  • http://www.erik-rasmussen.com/ Erik R.

    Thanks for that Ryan. It depends, of course, on whether the function you’re calling is returning the HTML as a string or actually writing it to the page. Plugins may vary on that.

  • http://www.kasdorf.net/wordpress Kaz

    Okay, I have been using the Widgetize this plugin for awhile and it has worked fine. I recently upgraded to WP 2.3.2 and it is either related or chance, but I cannot change anything IN an existing widget, or add anything to a new widget. It won’t save the changes. Anyone else see this, or do I have a conflict with another plugin?

  • http://www.erik-rasmussen.com/ Erik R.

    Kaz, it’s probably a conflict with another plugin. I don’t know exactly how or which, but that’s what I suspect.

  • http://www.kasdorf.net/wordpress Kaz

    Kaz here again, more information on my issue with the inability to edit anything in the widget. This also extends to the built in “text widget” within WP. It seems there is conflict with IE7 (one report of 6) that is killing the process for many people. I cannot create a new Text Widget or alter an existing one, the same as with the Widgetize Anything widget…..
    So, not necessarilly your issue, but is affecting it.
    Search the WP Forums for Text Widget (http://wordpress.org/support/topic/139464)

    Curious if you are using Firefox or not?
    Because that is the “Fix”…. and it does work. I can log off IE and onto FF and use your widget perfectly. So it does not seem to be a conflict between widgets.

    Anyone else try with IE and not working? ’cause if it isn’t anyone else maybe it is a IE configuration setting. I do notice even in FF that it takes a long time to write back to WP, I even get a message about “a script is running that is taking up resouces – do you want to continue”. I say yes, and a little later the changes appear, but only in FireFox. IE doesn’t even get that far.

    Just thought you may want to know.. and if there is anything you can do to assist even better.

    Kaz

  • http://www.erik-rasmussen.com/ Erik R.

    Thanks for all that info, Kaz. If it’s a problem with the regular Text Widget, then I don’t think there’s much that I can do. It must be a general javascript issue with WordPress. Yes, I use Firefox. I never use IE and I can’t really understand why anyone would.

  • http://www.janek-niefeldt.de/blog/mycustomwidget Janek N.

    Nice! Here is another plugin, that provides similar functionalities. I added some helpful features. So, if you like visit http://www.janek-niefeldt.de/blog/mycustomwidget.

  • http://www.wizebiz.ca Cecilia

    It is a very nice plugin. How can I delete the widget created?

  • http://www.erik-rasmussen.com/ Erik R.

    Cecilia: Drag it back off the sidebar, just like all other widgets.

  • http://anekostudios.com Shelly

    I thought I’d offer up a tidbit of information to a previous poster. Yes, you *can* change the box names from “Widgetize Anything 1″ to something else. I’ve done it for a few clients, actually (hacked from this site:http://br.bingorabbit.com/wordpress-hack) – it works very well.

  • Rodrigo

    Hi,

    I tried use your plugin and it doen´t works fine. It doesn´t allow change my sidebar more. The problem is:

    %BEG_OF_TITLE%teste%END_OF_TITLE%hello world

    Fatal error: Call to undefined function: ns_show_top_commentators() in /home/content/b/l/o/blogconcurso/html/money/wp-content/plugins/widgetize-anything/widgetize-anything.php(31) : eval()’d code on line 4

    What can I do to continue using and solve this problem?

    Thank you
    Rodrigo

  • http://www.erik-rasmussen.com/ Erik R.

    Rodrigo, cualquier código php que vale en un archivo php normal vale para el contenido del widget. Práctica con código dentro de un bloque de <?php en footer.php.

  • http://resteven.com resteven

    useful,thx!!

  • TJ

    This is my first time using WP and first time using widgets. Despite the detailed steps on Erik’s page, I can’t seem to install the Widgetize Anything. Can anyone give me even more idiot-proof steps for installation on my Mac? Thanks.

  • gestroud

    I don’t think this plugin will work with WP 2.7. I had to remove it from my sites because it caused white pages in the admin area. Too bad, this was on of WordPress’ must-have plugins. :-(

  • http://www.erik-rasmussen.com/ Erik R.

    gestroud, it still works fine for me in WP 2.7.

  • http://www.eBusinessMagazine.co.uk eBusiness

    I like this plugin, but:

    I have a problem with this plugin and WordPress 2.7. I’ve entered php code into the widgetize anything widget in my sidebar, and now when I reload the sidebar in the admin to change the code, I’m being shown a string of php code and no option to edit the contents of the sidebar.

    Any ideas?

  • http://www.erik-rasmussen.com/ Erik R.

    I haven’t seen any behavior like that, eBiz. I suspect that your php code probably has a quote, either single or double, that is conflicting with 2.7’s javascript for widget editing. I’m not sure what to tell you. Maybe you can find and fix the php code in the database directly with phpmyadmin or something?

  • http://www.eBusinessMagazine.co.uk eBusiness

    Hi, Erik. Thanks for the reply.

    I don’t know what happened, but today I reinstalled the plugin and it works! And now my magazine is well on the way to being perfect!

    Thanks!

  • gestroud

    My apologies. I used widgetize anything for 4 different plugins on a few different sites – finally narrowed it down to one plugin that completely wrecked Widgetize Anything’s functionality with WordPress 2.7. After removing the suspect plugin, Widgetize Anything works fine. Your plugin remains as great as ever.

  • http://urlredacted Diane

    Success BlogNet is a WordPress MU. Is this plugin compatible with MU?

    Everything I have been reading here is sounding quite positive and I look forward to your reply

    Best Regards,

  • Ted

    It looks like 2.8.2 breaks this plugin. Could be because of the new widget functionality (the ability to add multiple versions of the same widget). Any ideas how to adapt the plugin to work with the new version of WP?

    • http://www.erik-rasmussen.com/ Erik R.

      Thanks, Ted. I have noticed this, but didn’t know about that change in functionality. The ability to add multiple copies of the same widget was what made this plugin so difficult to write in the first place. I keep hoping that WP will just adopt allowing PHP into their text widgets. It wouldn’t be that hard…

      I’ll see what I can do.

  • Ted

    Thanks so much, Erik. That was fast! I love your plugin; it’s become one of the staples of any and all blogs I set up.

    And yes, I’m totally with you: Can’t understand why WP hasn’t allowed the ability to add php into the default text widgets.

    Just out of curiosity, have you tried this plugin?
    http://wordpress.org/extend/plugins/php-code-widget/

    • http://www.erik-rasmussen.com/ Erik R.

      I had heard of that, but never needed it. I just tried it, though, and it works great. 27 5-star ratings can’t be wrong!

      My solution to the 2.8.2 problem would just be to do what the PHP Code Widget already does, so I don’t see much point. I recommend switching to that one.

  • http://quintonwall.com Quinton

    Fantastic! I was shuddering at the thought of replacing ProgressFly, my favorite WordPress plugin, until I found your widget. You made my day (actually month!)

  • http://annuairepagesblanches.org/ Foante

    Success BlogNet is a WordPress MU. Is this plugin compatible with MU?