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.
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
- A WordPress Blog
- WordPress 2.2 or greater -OR- the Automattic Widget Plugin
Installation
- Download the plugin here: widgetize-anything.tar.gz (2.3 kB)
- Unzip the plugin into your /wp-content/plugins directory.
- Activate the plugin in your WordPress admin.
- Choose how many Widgetize Anything widgets you want under Options –> Widgetize Anything (see screenshots)
- Enter the desired PHP code into the widget on the Sidebar Widgets page in your WordPress admin (see screenshots).
- Drag the widget onto the sidebar where you want it on the Sidebar Widgets page in your WordPress admin.
Screenshots
The options screen
The simplest example: Hello World
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.

(42 votes, average: 4.67 out of 5)
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.
greets
Mikrosenshi
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
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!
Excellent!! Thank you, Erik!
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!!
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!
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.
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).
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.
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
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.
I can confirm the latest version works with WordPress MU 1.2.3. Thanks Erik for this great plugin!
Erik,
Thank you for the diligence you pay in keeping this plugin updated. Much appreciated.
gestroud
Thank you Erik for keeping this plugin updated
It works like a charm with 2.2.1
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 ‘
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
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
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
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.
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?
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?
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…)
No errors? Just no content?
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…
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.
javascript:alert(xss);
I am code stupid….anyone got a quick cut and paste for ad rotator? Need more than the 9 they give you!
Thanks
Hola, ¿el plugin es compatible con las versiones actuales de wp?.
Gracias
Galileo, sí. Lo estoy usando yo ahora mismo con 2.2.1. Todavía no he probado con 2.3.
Great Plugin!
Is there a fix on the way for WordPress 2.3?
Thanks.
It works fine in 2.3. I just upgraded and my sidebar is using it right now.
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.
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..
Yes. It was the PHP. Sorry for the bother. Thanks for the help.
excellent post. thansk for sharing.
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?
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.
Love this idea, but bad with code! Anyone have a cut and paste for me of the ad rotator code?
Thnax
Tony
Hi,great plugin!
Anyway to label the widgets differently than besides “widgetize Anything 1″?
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.
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!
Nice plugin. Now i can create several plugin in a sec!
very interesting.
i’m adding in RSS Reader
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!
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();
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.
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?
Kaz, it’s probably a conflict with another plugin. I don’t know exactly how or which, but that’s what I suspect.
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