Same-Size Thumbnails on Blog and Archive Pages
Crops featured images on blog, category and search pages to the same 16:9 shape, so post grids line up evenly even when images have different sizes.
Opens WPIDE on
Code
.blog .post-thumbnail img,
.archive .post-thumbnail img,
.search .post-thumbnail img,
.wp-block-post-template .wp-block-post-featured-image img {
width: 100%;
height: auto;
aspect-ratio: 16 / 9;
object-fit: cover;
}
Notes
Change aspect-ratio to 4 / 3 or 1 for other shapes. Single posts show the full image.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.