Hi Rangi
Kind of … you can use the string length formula dotnordic gave above within a template.
I ended up using several, so ….
if( string length > 1 ) print a
if( string length > 2 ) print a
if( string length > 3 ) print a
if( string length > 4 ) print a … etc. (could be print a; print b; print c; etc.)
I used this on single post templates. A bit long winded to set the template up but once done you can forget about it. (In my case, I also made an extra custom field to generate 1 | 2 | 3 extra ‘a’s, if they were needed for a particular post – for example because there were lots of sub-headings and short sentences which meant the actual string length of the content was quite low. I don’t use this any more, so can’t point you to an example, sorry.
If you want to match sidebar length on pages with multiple posts – e.g. category lists, post lists, etc., I’ve cheated. Instead of having a sidebar, I include what would have been in the sidebar within the post format. This only works where you want the same thing, or sort of thing, for each listing. I use the RANDOM TEXT plugin so that the wording in the template is constant, but the actual output is random.
Example here: A category page on my site
(Some of) the items on the right are randomly generated by that plugin. If I changed the settings to list eight posts instead of four, it would generate eight (or however many are needed) ‘extra’ items, so there’s no ‘white space’. This example actually generates the content randomly twice – which category it prints from is chosen randomly from a list of possible categories I’ve defined. Clever, in a way, I thought … but actually really easy to do, once you understand the basic idea.
If you want to show ‘widget 1’ for short lists, if it’s long enough show ‘widget 2’, if it’s still longer show ‘widget 3’ etc. … you could do that via the top method. No reason it wouldn’t work on a multiple posts template as well as a single one. Just a bit harder – I guess – to automatically work out how long the string is, and you’d have to decide in advance a maximum length, so you’d know how many “if” statements you need.
Hmmm. I may have made it sound more confusing than it actually is! It’s fairly easy. Just takes a little time and experimenting to get it to work / look how you want.
Hope this helps. Feel free to ask a more detailed question if you decide to try one of the methods and get stuck. I’m not ‘all knowing’ but at least I have the benefit of some small amount of experience.
Best regards