Single post layout based on featured image size

I have two minimum image sizes to play with. One is 420x640px (“standing”) and the other one is 980x420px (“landscape”). The normal loop with a regular layout is in place in my theme.

The goal is to produce a layout for a single post that first check the size of the featured image (ie. “check if post has featured image size max width of 420px, if true addclass layout-single-post-standing” or something like that).

Read More

I have been reading about responsive design but I am a beginner when it comes to that. Do any of you have an idea on where to start with this?

UPDATE:
Dictating layout based on the size of a featured image could be considered a flimsy mechanism. As it panned out this method worked very well. By making use of the built-in twentyten_header_image_width feature (functions.php) and extending it with several conditional statements (wp_get_attachment_image_src and more) in the WP Loop, as well as setting several (add_image_)sizes, we managed to pull it off. It is a very complex WP Loop with tons of echos but it meet our goal of using featured image size to decide on what layout to present to the visitor.

Related posts

Leave a Reply

1 comment

  1. The problem there is that the WP uploader will automatically resize any image you upload to all your specified image sizes, providing the original is larger than the specified size.

    Relying on uploading an image between two specific sizes is a very flimsy mechanism for dictating layout. What is actually different about the content of these posts – can they be categorized differently? Can you add a custom field that you can test for in your template and use that to control the layout?