30
November
2006

Widgetize Anything

39 Votes | Average: 4.69 out of 539 Votes | Average: 4.69 out of 539 Votes | Average: 4.69 out of 539 Votes | Average: 4.69 out of 539 Votes | Average: 4.69 out of 5 (39 votes, average: 4.69 out of 5)
Loading ... Loading ...

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!

Upgrading to Wordpress 2.2.1 breaks version 1.0 and 1.1 of this plugin!! You will have to re-download the plugin (now version 1.2) to fix the problem.

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.

65 Comments

  1.   WordPress Plugin: Widgetize Anything by Blogging Pro CANADA:

    [...] I haven’t really gotten into the whole Widgets thing (please don’t burn me at the stake), but I have been excited at the idea of Widgets. The thing that is holding me back is that I would want just about everything to be a widget, and now it seems for the most part you can, thanks to Erik’s Widgetize Anything plug-in. 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! [...]

  2. Wigetize Anything Plugin · Wordpress Workshop UNITED STATES:

    [...] Get it here. [...]

  3. Wordpress Widgetizer on iface thoughts UNITED STATES:

    [...] I had meaning to build a widgetizer - something that could widgetize any plugin for Wordpress. But Erik Rasmussen has beat me to it (via Blogging Pro). It might look like just another text widget, but it executes the PHP code typed within it. Wordpress introduced widgets in its recent versions, but not all plugins were widgetized creating problems for users. I had widgetized the Random Quote plugin and wanted to widgetize some more. The difference between what I had thought and this widgetizer is that this will not be able to customize plugin options through the widget GUI. I wonder if this can be built on it! [...]

  4. Code Widgetizer at Just Ducky INDONESIA:

    [...] Sedikit kan persyaratannya? Dan simple pula dalam pemenuhannya.. Plugin ini sendiri sih benernya fungsinya merubah script ato code (PHP) yang kita masukkan menjadi module widget, sehingga bisa dengan mudah kita drag and drop di sidebar blog kita. Seperti kita tau bahwa module Text yang ada di ‘sidebar widget plugin’ tidak bisa digunakan untuk code PHP, dengan plugin ini hal itu sudah bisa diatasi. Untuk lebih jelasnya sih silakan liat di plugin page-nya.. selamat mencoba Filed under blogthing.  | Tags: code, PHP, plugin, script, widget. var blogTool = “WordPress”; var blogURL = “http://i-bebek.net”; var blogTitle = “Just Ducky”; var postURL = “http://i-bebek.net/index.php/2006/12/01/code-widgetizer/”; var postTitle = “Code Widgetizer”; var commentAuthorFieldName = “author”; var commentAuthorLoggedIn = false; var commentFormID = “commentform”; var commentTextFieldName = “comment”; var commentButtonName = “submit”; [...]

  5. BloggingPro China » WordPress Plugin: Widgetize Anything UNITED STATES:

    [...]   Widgetize Anything,现在兼容Widget的插件已经越来越多,但是仍有部分优秀的插件并没有针对Widget做过修改,本插件就是让它们能更好的和现有Widget系统兼容。   上传激活,在Widget中使用Widgetize Anything,在相应对话框中加入其它插件的输出语句。 Tag: widget [...]

  6. Full(o)bloG » Blog Archive » Cosa manca alla template? UNITED STATES:

    [...] spostare tutto lo spaghetti php della template all’interno di plugin e widget –> rivalidare XHTML [...]

  7. Emerging Tools and Technologies » Plugin: Widgetize Anything UNITED STATES:

    [...] December 28, 2006Plugin: Widgetize Anything This plugin widgetizes any blog regardless of whether it already supports widgets. You still have to upload the widgets plugin after this, though. http://www.erik-rasmussen.com/blog/index.php?p=140 Filed under WordPress by Tom Permalink • Print • Email • Comment [...]

  8. WPのプラグイン:Widgetize Anything UNITED STATES:

    [...] ダウンロード:Erik’s Blog » Widgetize Anything [...]

  9. BLOGIK » Blog Archiv » Es ist vollbracht SWITZERLAND:

    [...] kann, die eben nicht als Widgets geschrieben sind. Da habe ich zum Glück auch was gefunden: Widgetize Anything – das ist wirklich genial. Da kann man direkt auch PHP Code einfügen und eben auch den Code [...]

  10. sein » Blog Archive » wordpress 的几个细节修改 CHINA:

    [...] 在侧栏显示随即文章 需要桑葚中文 WordPress 工具箱和 Widgetize Anything 两个插件,然后在模板的Sidebar Widgets 里增加一个Widgetize Anything1 ,内容为 [ [...]

  11. Mikrosenshi GERMANY:

    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

  12. gestroud UNITED STATES:

    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

  13. erik SPAIN:

    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!

  14. gestroud UNITED STATES:

    Excellent!! Thank you, Erik! :)

  15. anthabax MALAYSIA:

    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!!

  16. erik SPAIN:

    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!

  17. Richard Bui UNITED STATES:

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

  18. erik SPAIN:

    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.

  19. Rob UNITED STATES:

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

  20. gestroud UNITED STATES:

    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. :-(

  21. animator GREECE:

    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

  22. erik SPAIN:

    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.

  23. Richard Bui UNITED STATES:

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

  24. gestroud UNITED STATES:

    Erik,

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

    gestroud

  25. animator GREECE:

    Thank you Erik for keeping this plugin updated

    It works like a charm with 2.2.1 :)

  26. prashanth INDIA:

    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 ‘

  27. erik SPAIN:

    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

  28. marcus INDIA:

    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

  29. marcus INDIA:

    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

  30. erik SPAIN:

    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.

  31. Henrik SWEDEN:

    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?

  32. erik SPAIN:

    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?

  33. Henrik SWEDEN:

    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…)

  34. erik SPAIN:

    No errors? Just no content?

  35. Henrik SWEDEN:

    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…

  36. erik SPAIN:

    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.

  37. a guy UNITED STATES:

    javascript:alert(xss);

  38. Tony UNITED STATES:

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

    Thanks

  39. Galileo SPAIN:

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

    Gracias

  40. erik SPAIN:

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

  41. S. Lynch UNITED STATES:

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

  42. erik SPAIN:

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

  43. S. Lynch UNITED STATES:

    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.

  44. erik SPAIN:

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

  45. S. Lynch UNITED STATES:

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

  46. Learn PHP CANADA:

    excellent post. thansk for sharing.

  47. Dennis UNITED STATES:

    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?

  48. Caroline UNITED STATES:

    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.

  49. Tony UNITED STATES:

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

    Thnax
    Tony

  50. Giun UNITED STATES:

    Hi,great plugin!

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

  51. Erik R. SPAIN:

    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.

  52. Joseph UNITED STATES:

    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!

  53. apad MALAYSIA:

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

  54. music SPAIN:

    very interesting.
    i’m adding in RSS Reader

  55. jimbabwe UNITED STATES:

    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!

  56. Ryan UNITED STATES:

    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();

  57. Erik R. SPAIN:

    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.

  58. Kaz UNITED STATES:

    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?

  59. Erik R. SPAIN:

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

  60. Kaz UNITED STATES:

    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

  61. Erik R. SPAIN:

    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.

  62. Janek N. GERMANY:

    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.

  63. Cecilia CANADA:

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

  64. Erik R. SPAIN:

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

  65. Shelly UNITED STATES:

    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.

Want to change the avatar that shows up next to your comment? Sign up with gravatar.com and upload a new avatar. Make sure you use the same email address you leave comments with.

Leave a comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

 
©Copyright 2007 - All rights reserved.