Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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).

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.

share|improve this question
add comment

1 Answer

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?

share|improve this answer
    
I have no trouble sorting the issue with how WP handle image uploads. The posts share the same category and can not be separated. It has to boil down to being able to have two different classes for layout, based upon the width of the featured image (post thumbnail) –  Scriptamateur Feb 20 '12 at 11:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.