1
votes

It's always a drag trying to make sidebars the same height as the page content - too short and your page gets boring at the bottom, too long and your page looks like a run-on sentence.

Is there any way to add/remove/display widgets based on content length, so that the sidebar will only display another widget if there's a ton of sidebar whitespace available?

I'm aware of the overflow CSS property, and would rather try to find a different method :)

2
I think with this practise you run into usability problems. It's confusing when you brows on a webpage and a important part of the page(e.g the main navigation, or in your case the sidbar) change every click. - crashbus
Definitely. In this case, the sidebar is mostly extraneous widgets, not vital information. The widgets that would change are just filler content like a poll, a second 'latest posts' widget, stuff like that. - emc

2 Answers

0
votes

I agree that it would be better to avoid this altogether. Users are used to a constant sidebar size, with some pages shorter than the sidebar and some longer than the sidebar.

However, that doesn't actually answer your question. It is theoretically possible to determine the length of the post and make some judgements on which widgets to include based on that; however, it's beyond my skill.

As a halfway solution, you can use a widget that gives you more control over the sidebars. I prefer http://wordpress.org/extend/plugins/conditional-widgets/ but I think http://wordpress.org/extend/plugins/widget-wrangler/ would work well too. With those you could specify which widgets appear on which pages. If you have hundreds of posts of different lengths this may not be suitable, but if you have a handful of pages you could use this to add more widgets to specific pages and have fewer widgets on pages you know are shorter.

Hope this helps!

0
votes

here is an interesting post about a dynamic sidebar depending on length of page. Does this help?