Many WordPress users have been finding that a large number of the plugins they have tried to install in their sidebars lately aren’t working. In most cases, this is purely because your theme is widgetized.
Widgets were originally a plugin that allowed you to easily edit your sidebar content. As of version 2.2 of WordPress, it comes as default. Widgets can be very useful, but they have caused some people some trouble. Thankfully, there is an easy solution.
The Problem With Widgets
The problem is that some people forget about widgets when they add their plugins.
Have a look at your sidebar.php file. You will find that it resembles the following:
<?php /* Widgetized sidebar, if you have the plugin installed. */
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>// Normal sidebar content here.<?php endif; ?>What this means is that if your version of WordPress is widget-enabled, everything between those PHP tags will be ignored.
It is of course possible to get your plugins to work by simply placing the plugin code outside of these tags. The problem is that this means your plugin must be at either the top or bottom of the sidebar. It cannot be in the middle.
The Solution
The simple solution comes in the form of a plugin from Otto Destruct, called ExecPHP. After installing ExecPHP (Same installation as any other WordPress plugin), you will have the option to add “PHP Code” widgets on your widget page. These widgets, unlike the default text widgets, can take PHP code, so to install your plugin, just paste the code into one of Otto’s PHP widgets!
Simple, painless solution, which can be seen in action on Pro Blog Design.

What do you think of widgets? Are they useful?
Custom Search
redwall_hp (139 comments)3 September 07
My solution: Un-widgetize your theme.
Steven Snell (24 comments)3 September 07
I think widgets can be useful, but too many blogs over use them. I hadn’t seen ExecPHP before – there’s a plugin for everything.
Slevi (73 comments)3 September 07
ExecPHP, does it still ask of you to disable your rich text editor in order to function properly? I tried it in the past once when I wanted to use dynamic pages but it was more of a pain than anything else by the way it affected the rest.
Don’t know if the trouble arises as well when you don’t use any php in the RTE but still.
And I agree with redwall_hp on simply undwidgetizing it, it’s not like the widgets are desperately needed
.
Elliott Cross (16 comments)3 September 07
I think widgets are good, however some of them have created havoc with my site and a few others I have done. From a developer/designer/coder standpoint, I prefer to just hardcode them as it allows me more control over the content and layout. This also prevents problems with validation, etc.
Michael Martin (1319 comments)3 September 07
Redwall – lol, well yes, that’s one solution! I like widgets though. For someone who edits their sidebar as much as I do, they’ve been very useful.
I agree that you can easily live without them though. The reason I first widgetized this theme is just because there was an Amazon widget I wanted to use (Which I only partially use now, to get the URLs. The Amazon links I have are a random-text widget). There are some useful plugins that are only available as widgets.
Steven – There really is!
Slevi – Ahh, I know the ExecPHP you’re thinking of. This is actually a different mod by the same name.
Elliott – I’ve found some poorly coded widgets/plugins out there as well. The time it would take to hardcode your own versions would be a fair amount though.
Liberty and New Creation (6 comments)3 September 07
ExecPHP has been a lifesaver. You can literally do anything you want with it.
Michael Martin (1319 comments)3 September 07
Yep! I love it. I have a widget for everything now.
Dean @ Technical Itch (1 comments)3 September 07
I used to use a plugin called sidebar modules (SBM) which was far better than the old widgets plugin, but I think it stopped working when Wordpress 2.2 got released. So I just edit the sidebar.php directly these days.
Michael Martin (1319 comments)3 September 07
It’s a shame when some plugins just stop being updated Dean. At least you had the ability to get along fine with the sidebar code though. Quite a few people would be a little daunted by that prospect.
redwall_hp (139 comments)3 September 07
“Quite a few people would be a little daunted by that prospect.” I’ll bet those are the people who use prefab themes…
Michael Martin (1319 comments)3 September 07
To a point, I suppose. But if you’ve been using widgets for a while now, and are used to that system, the idea of having to code manually would be unwelcome at the least, in most cases.
Slevi (73 comments)3 September 07
True to that
, although I don’t use any widgets definitely the fact of simply taking plugins from the web and using prefactured web-software totally makes you lazy
. Back in the ancient days stuff like that all would be considered so much weirder, it’d just be stuff you’d code yourself but now everything related to coding tends to become unwelcome in more and more aspects.
As for the ExecPHP, thought there was just one, but apparently I’ve been fooled again by those people naming their plugins identically
. Guess I’ll check this one out one day then and see if it’s any better than the other ExecPHP.
Michael Martin (1319 comments)3 September 07
Nothing wrong with being lazy every now and then, right?
There’s too many plugins for everyone to have a different name. Still, so long as they keep writing great plugins, they can name them whatever they want for all I care!
kristarella (141 comments)4 September 07
I really like widgets. They’re so handy to change things around or add things quickly.
I used to have to wait to get home to edit my sidebar files and upload it via FTP, now I can change it from WP admin (I now have my permissions set so I can edit the theme from admin too, but it took me a while to get around to doing it).
Michael, you’re right about becoming accustomed to this method. I don’t dislike coding, but sometimes it becomes more laborious than you expect.
‘“Quite a few people would be a little daunted by that prospect.” I’ll bet those are the people who use prefab themes…’
If they are using pre-made themes with widget enabled sidebars then surely it’s good for them to be able to modify the sidebar easily?
I’m using ExecPHP (the one you linked to) at the moment for my links/blogrolls – as far as I know it’s working well. I don’t know if it has any effect on the rich text editor because I don’t like to use the RT editor.
Elliott Cross (16 comments)4 September 07
You’re right, it does take some time to handcode the sidebars, however I have created valid code options and just upload the sidebar into each project. This allows me to save some time, and it is relatively easy to reuse and modify as needed.
As for the widgets, it takes a little tweaking to get them valid, and then once you upgrade your version, unless you save and reload the widget.php file that you modified, you will loose your work.
Laarni (4 comments)4 September 07
Thank you for sharing. I’ve been searching for this. I remember posting a thread on this at TBE.
Thanks once more.
Mommy Zabs (45 comments)4 September 07
Oh wow, I can’t wait to get time to download this and try it out. I”M SO TIRED of plugins that won’t work for me. I didn’t start hosting my own sites until 2.2 came out so this is all I have had! I am learning more code on the sidebar.php – but I think I will mostly stick to what i know.
Thanks for letting me know why all these things won’t work for me. When I get around to it I will try it out and let you know how it worked…
Michael Martin (1319 comments)4 September 07
Kristarella – Agreed. It’s not so much that a person couldn’t update the sidebar, but that their time could be better spent on something else. I’m all for time-savers online.
Elliot – That’s a good way of reusing code. Do you find that many of your codes break when Wordpress goes to a big new release? (1.5->2.0, 2.0->2.1 etc. ). Would that not take a while to fix usually, unless you know your coding structure for each code very well?
Laarni – No problem. I’ll see ya on TBE!
Mommy Zabs – You can guess what made me first search for this plugin!
The King plugin I linked you to a while back has problem with Wordpress 2.2 in general. Sorry that I hadn’t tested it on 2.2 at the time. Eventually, I found this, which works a charm.
Mommy Zabs (45 comments)4 September 07
I was wondering if that is why! So basically if i use this plugin I can use the php for sidebar toggle on a widget correct? and I will then be able to get top commentors to work?
Michael Martin (1319 comments)4 September 07
Well, in theory, but the luck we have with the sidebar toggle on your site was horrendous.
But top commentators will definitely work.
milo (72 comments)4 September 07
I hate widgets, you’ll loose control of the look and feel of the site, however the exec plugin is very powerful. And the WP rte is pure crap.
Michael Martin (1319 comments)4 September 07
Milo – The widgets are just a way on entering content. You still have complete control over how it is displayed.
A lot of people agree with you about the RTE though. I don’t mind it so much, but I’ve recently taken strongly to Windows Live Editor. Very nice program.
kristarella (141 comments)5 September 07
Jeepers milo, strong response! I agree with Michael though, you can easily control widgets via css or tweaking them a little.
Didn’t know what RTE was until Michael’s reply, I haven’t used it much, but perhaps that’s why (because it’s nasty)
milo (72 comments)5 September 07
Ok, tweaking of widgets IS possible, but why I should do that? Creating/modding a js script is much easier than fiddling with the widget. Also importing it into the functions is dead easy, this way mixing two applications is allowed, what is impossible with the widgets.
Rte, never used it, scrambles almost all codes.
kristarella (141 comments)5 September 07
Well, there you have it – I haven’t learnt JS yet, I’m completely useless at it, therefore much harder to create/mod
Mommy Zabs (45 comments)7 September 07
YAY top commentors worked on my one site, will have to do it on my mom site!
Otto (1 comments)12 September 07
Heh. I probably should have named that plugin better.
Anyway. This ExecPHP widget has nothing to do with the RTE. It will work fine either way.
I’m still trying to get this functionality into the core code, along with some other stuff. Perhaps in WordPress 2.3.1 or something.
Glad you all like it!
-Otto
Michael Martin (1319 comments)12 September 07
Thanks for stopping by Otto. I’m using the plugin here, and I love it. If the name is the biggest issue, I’d say it was a job well done.
Getting it built into the core package would be great. I can’t think of any good reason not to as it really does punctuate the usefulness of widgets.
Angelea (1 comments)17 January 08
eh..depends. They’re useful sometimes. But if I wan’t something other than a widget, like blogrush for example…then I’m out of luck
kristarella (141 comments)17 January 08
Angelea – I’m not sure what blogrush is, but have you ever come across I sidebar thingy that wasn’t html, javascript or php? If not, then they all work in a text or execphp widget.
Michael Martin (1319 comments)17 January 08
You can put anything inside a widget, Angelea. e.g. With Blogrush, you would just paste the code inside a text widget.
Settor72 (1 comments)22 October 09
Sad14 (1 comments)23 October 09
Note to Google: Are you the only ones bidding on this? ,