Featured Image Cropping
-
I’ve used the below code to inject featured images into my theme but wanted to know if there was a way to crop the image to an exact height instead of using 9999 and then overflow: hidden. I tried putting in the height and the images don’t size properly width-wise. Did a bunch of googling for answers but the plugins etc I found didn’t seem directed to featured images, and seemed too complicated for my client would like it to be a bit more hands off. The true dimensions were supposed to be 420×190 and 190×120
// This theme uses Featured Images (also known as post thumbnails) for per-post if ( function_exists( 'add_theme_support' ) ) { add_theme_support( 'post-thumbnails', array( 'post' ) ); set_post_thumbnail_size( 420, 9999 ); // default Post Thumbnail dimensions } if ( function_exists( 'add_image_size' ) ) { // Single post thumbnails add_image_size( 'single-post-thumb', 420, 9999 ); // Blog post thumbnails add_image_size( 'blog-post-thumb', 190, 9999 ); }
- The topic ‘Featured Image Cropping’ is closed to new replies.