ifacethoughts

Problems With Widgets In Wordpress

I had not thought a lot about the impact of widgets in Wordpress until I started developing this theme.

The Advantage

Well, let me first put down the advantage of widgets, as I see them. Wordpress provides a neat drag and drop interface to include and adjust widgets in the sidebars. The only condition for this is that the theme you are using should be widgetized. This means that now you can add, adjust or delete content from your sidebar without editing a single line of code, which simplifies it a lot for the non-technical users. Pre-widgets, most of the plugins required you to change code to be able to include them.

The Problems

Now lets get to the problems.

Different sidebars

The biggest is that my sidebar now becomes static across all the template files. By static I mean that when I could edit the code I could include plugins conditionally in the sidebar. For example, the home page of this theme has a mullet style design. As a personal preference I would not like to include the recent posts widget on the home page, but would like it to be there on pages - when I am reading a single post or a page or the archives. Digging deeper, I could complicate this matter by applying this to multiple template files.

This can be easily handled if I am writing a widget by including conditional calls like is_home(). However, this will not be known to the widget author but the widget user. Today, if I want to do what I want to do with recent posts widget, I will have to hack into it. I usually prefer not to hack as it causes problems in upgrades and migrations. But I will have to do it probably.

Widgets still not a Standard

There are some users and developers out there who do not like widgets. This has resulted into some plugins and themes that are not widgetized. Most of the new ones are being, but the olders ones, which are excellent, are not widgetized. This means that either the user has to widgetize the plugin or avoid using it. The former option negates the advantage of not requiring to change the code in the first place the later is discouraging.

The last option of using both widgets and non-widget plugins complicates your code. And it also does not let your intersperse non-widgets with widgets.

Possible Solutions

These solutions might be completely frivolous, but they still are thought, but not well thought of yet.

Just like a theme registers its sidebars with Wordpress, it can also register all its template files. Now Wordpress can offer inclusion of widgets per template file. If not explicitly specified, it can probably follow the excellent template hierarchy. This way we can also choose to change order of the widgets on different pages.

Or better, we can develop a plugin which can widgetize a plugin without change in code, so that we can include it anywhere we want.

These might not be a solutions at all and might actually kill the whole effort of simplification. Widgets offer an excellent solutions in cases like Wordpress.com where they add value. But in self-hosted blogs they can create hurdles. We need to find a stage where probably widgets should phase out the pre-widget plugins. Both of them together can complicate the things.

This theme currently has the sidebar and both the bottom bars widgetized. I have to find a solution for using the widget and non-widget plugins.

Discussion [Participate or Link]

  1. Rationale Behind The Current Design on iface thoughts said:

    [...] I am not using any widgets currently, I call the functions in the correspondingly place, even while using widgets. I plan to show different content for different context and felt restricted while using widgets. [...]

Say your thought!

Who are you?

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.

freshthoughts

freshcomments

personalfavorites

contactme

Abhijit Nadgouda
iface Consulting
India
+91 9819820312
Y!: anadgouda
GTalk: anadgouda@gmail.com
MSN: anadgouda@hotmail.com
Skype: anadgouda

currentproject

Complete Wellbeing

thoughtfulthoughts

Don’t EVER make the mistake that you can design something better than what you get from ruthless massively parallel trial-and-error with a feedback cycle.

That's giving your intelligence much too much credit.
Linus Torvalds

badgesand...

This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.

Twitter - Couchdb can be a perfect fit for a lot of publications.