This is untested, but should be a step in the right direction:
within the loop:
//get url of featured image
$atts = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()));
if ($atts) { //if an image was found
$width = $atts[1];
$height = $atts[2];
if ($width / $height > 3) {
echo "is at least 3 times wider than it is tall";
}
}
(old links, used in original answer)
Thanks to Pat J for the tip about wp_get_attachment_image_src(). Much, much better.
Related Posts:
- Including post thumbnail url in loop’s post object to reduce number of queries
- Pulling in featured image into default recent posts widget
- Closing the loop…featured image variable based on post id
- WordPress get post thumbnail url
- How to output thumbnail twice in a loop
- Default featured image set as background image [closed]
- How can I access a post’s feature image outside the loop?
- How to check all items in a loop have post thumbnail?
- Thumbnail Image Rounded Corners w CSS (or any other good method)
- wp_get_attachment_url not fetching URL?
- Thumbnail of the latest posts page
- Pages with a loop (index, archive) are loading the first image as post_thumbnail
- Display Featured Image
- Place the Featured image on a post, before the first via code
- Counting the posts of a custom WordPress loop (WP_Query)?
- How to split a loop into multiple columns
- Is it necessary to reset the query after using get_posts()?
- Is there any difference between the_title() and echo get_the_title()?
- Cleanest Way to Select Every Second Element in a Loop?
- Pagination not working on home page
- Get post by page name or slug
- save_post + insert_post = infinite loop
- Get ID of a page containing secondary loop in content
- is_home, and is_front_page conditional problem
- ACF Repeater loops and resets – where is the reset_rows() documentation? [closed]
- Why do themes have `while( have_posts() )` in templates like single.php?
- What is best way passing variables to theme templates and using them different places like widgets?
- Apply styling only to first page sticky posts
- Exclude category by slug for for each loop
- pop-up lighbox with AJAX
- WordPress Loop Through Particular Pages
- Display date only once for a each set of posts relating to that date
- Load comments per post on click with AJAX
- The main Loop is not starting in a custom blog template page
- connect last post with first post
- Chopping up a large ajax request of around 200 posts [closed]
- Combining the_excerpt with the_content
- Custom loop with conditional statement to separate each terms
- taxonomy tags 404 to custom post types
- Breaking the loop?
- How to get an array of years from all of the search results, and use it to filter by year the paginated loop?
- woocommerce stored variable
- A smarter way to display multiple loops inside a page template
- How to print out menu names in the foreach loop?
- How do I style the first two posts of a loop
- Do I need to use The Loop on pages?
- How to get the role id from the role name?
- How do I paginate a get_posts() request inside another page loop (Paginating childpages)
- Is wp_reset_postdata() redundant after the main loop?
- Exclude first post (sticky or not) from the loop using query_posts()
- How to display the featured image for each post?
- In Custom page – next_posts_link Not working while previous_posts_link is working
- Escape current post from loop
- How do I display the latest posts from three different categories?
- Show articles in Pair
- Make a loop to return x number of posts, but only if they have content or excerpt
- How do you stop the rendering of the website to have something display on the front-end?
- Why the first with flexslider appears as blank on my code?
- Rendering pages
- add_action in the loop hooks
- How can have a conditional template tag based on the main loop within a secondary loop with new WP_Query(), using get_template_part()
- How to render the single post template with the post name?
- Reset Loop get_posts();
- WP_Query is only looping home page, not pages
- How to filter posts by category INSIDE the loop
- Offset Loop by 1 , Limit next loop to 1 (Most Recent) Post
- How to show multiple attachements together with Scribu’s Posts 2 Posts connector?
- Custom Header added within Dashboard pages, is this possible with custom template files?
- Loop order issue with Ajax filter
- Database query and get_user_meta return incorrect data
- Adding a second loop breaks everything
- Need to while loop and display contents in the subfield of a group field given by ACF
- Custom Query with Sticky Posts
- How to display a loop of custom post types in columns
- dispaly all hierarchical post types from a taxonomy
- WordPress Modal showing posts not working properly
- Query posts and display all dates in repeater field in chronological order
- Return only one post format in index.php [duplicate]
- Multiple loops in set intervals with code in between
- Attachment Metadata inside of Loop
- Modify widget to output posts in custom order
- Template included with plugin doesn’t return all posts for custom taxonomy
- Limit article to 100 characters. Can’t use the_excerpt…
- Return only content in excerpt field in loop
- Adding pagination to WP_Query [duplicate]
- Insert/sticky multiple posts in multiple positions
- This webpage has a redirect loop issue with SSL page
- Buddypress Group Activity Loop Filter activity type [closed]
- Stuck with conflicting loops on page template
- How to get current page id and compare it to looped pages inside the same page?
- Show amount of posts created today above loop?
- How to create WordPress loop with combination of 4 and 2 columns twitter-bootstrap?
- posts_nav_link() not working on index.php
- How to add custom HTML markup and classes to the_content()?
- $do_not_duplicate is not working in genesis theme
- Loop displays current page
- wp_mail sending only once inside foreach loop
- How to use orderby on meta_value when using Pods custom database table storage
- wp_mail function not working in user query loop
- How to set and retrieve cookies while in the loop