Solving The Empty Widget Problem

Jul 8, 2009   //   by Hackadelic   //   WordPress  //  1 Comment

Emptiness / VacíoWhen you want to display a TOC box in your sidebar using a text widget and the toc shortcode, and there are no headings to display, you effectively get an empty widget. An ugly affair sometimes… Here is what you can do about it.

An empty widget wouldn’t be a problem if the widget wouldn’t be displayed. On my theme, for example, empty widgets have zero height, so they are not visible. But on many themes an empty widget leaves you with an unattractive blank rectangle in the sidebar.1

One way to overcome the issue is to use, for example, “Widget Logic”. But if “emptiness” is the only thing to circumvent, then “Widget Logic” is probably overkill.

Obviously, the immediate solution is a text widget variant that is not rendered at all when empty.

And here it is: The Discrete Text Widget.

  1. The empty widget issue has been reported by GhostLyrics. []

1 Comment

  • its working for me.thanks

Blog Categories

I have come here to chew bubblegum and kick ass...
and I'm all out of bubblegum.
-- Nada in They Live