define a fixed ratio for the featured images
-
Hello, I need to define a fixed ratio for the featured images of my posts so, when i view my posts in the in the grid of the category / archive page, the view is pleasantly ordered and organized.
Is there a css code that I can add in the ADDITIONAL CSS CLASS(ES) field?
Thanks
-
Hi @ictgo – thanks for opening your own thread. Could you provide a link to a sample category/archive page so I can have a look directly?
Also, please note that CSS overrides do not go in the “Additional CSS classes field,” it has to go in a CSS editor – Additional classes is for something else. 🙂
While the Customizer is not exposed by default when using block themes and Site Editing, you can still access it manually by adding
/wp-admin/customize.phpafter your URL. You can then add custom CSS in the Additional CSS area.Actually the website is still under construction but I try to elaborate.
The category/archive page is the page that shows all the posts (you can filter them by tag or category). With the WP 2022 theme you can choose to show the posts one below the other or in a grid view (2 or 3 columns…).
I’d like to define a fixed ratio so all the featured image are of the exact same size and the grid is uniform.
Try going to the Site Editor’s templates area, at Appearance > Editor > Browse all templates
Click the Archive template to edit it. (This is the template that controls the display of category and tag pages in Twenty Twenty-Two, unless you’ve added your own custom template.)
Select the Post Featured Image block.
In the Settings area on the right, go to the Dimensions section and define your desired height and width. Make sure the Scale option is set to Cover.

Let me know how it goes.
Great Kathryn!
is there a way to define the ratio and not the specific pixels dimension?
In addition, would you mind to tell me if there’s a way to define different numbers of last posts shown in the home page (I’d like to keep just the last 3 posts) and in the archive (here I can visualize the last 9 posts)?
Hi @ictgo –
is there a way to define the ratio and not the specific pixels dimension?
No, the ability to define a specific aspect ratio for featured images is not currently available. This enhancement is something that developers are working to implement in a future version of the block editor, as you can see in these GitHub issues:
https://github.com/WordPress/gutenberg/issues/47274
In addition, would you mind to tell me if there’s a way to define different numbers of last posts shown in the home page (I’d like to keep just the last 3 posts) and in the archive (here I can visualize the last 9 posts)?
You can define the number of posts that you’d like to appear in each individual Query Loop with these steps:
- In each template (i.e. Home and Archive, or whatever other templates you’re using), toggle off the “Inherit query from template” option:

- Then, click the “Display Settings” icon on the Query Loop toolbar, and select the number of items per page to be displayed

Wonderful Kathryn, it works but there’s a situation now.
I use just two kind of post categories: tournaments and news. In my menu there are two link dedicated to each category. Since I’ve followed you instruction, both link show me all the posts, without the “category filter”. I don’t understand why
Heya @ictgo – is it possible for you to make your site live temporarily so I can see what you’ve done more clearly? It’s tricky for me to understand what’s going on unless I can see your site directly.
If not, could you please explain step-by-step what you’ve done so I can try to replicate it.
I use just two kind of post categories: tournaments and news. After I’ve followed you instructions, both link show me all the posts, without the “category filter”.
This archive should contain only “news” posts https://www.golfclubcolliberici.it/category/news/
This archive should contain only “tournaments” posts
https://www.golfclubcolliberici.it/category/tournaments/Thank you for your help
@ictgo Ah, I see what you mean! When you turn off the “Inherit query from toggle” you do get all the posts in the Archive template, as you’re seeing.
There are a few ways around this, but I might suggest trying the following first:
- Toggle back on “Inherit query from toggle” on the Archive template
- Make sure the number of posts you’d like displayed on your archive pages (like category pages) is set at Settings > Reading, “Blog pages show at most”
- Double-check your homepage to make sure the Query Loop there still looks right. (This one is controlled by the settings in your Home template’s Query Loop block.)
Let me know how it goes!
-
This reply was modified 3 years, 1 month ago by
Kathryn Presner. Reason: edit in first sentence for clarity
Kathryn…. Just great!
🙂
Awesome, glad that sorted it!
For any new questions, please feel free to make a new post. Thanks!
The topic ‘define a fixed ratio for the featured images’ is closed to new replies.
