Change Recent Post Shortcode Thumbnail Size


Any way to change the thumbnail from what it is by default to be the ratio of the featured image instead of cropped how it is (landscape)?

Link for reference:

If you scroll down to “Holiday & Seasonal” you can see a post feed there.

Any ideas?

Hello Frank,

Thank you for the very detailed post information. Actually what you have in mind has been ask before. Please refer to this thread to know how I explained the suggested resolution:

We would love to know if this has worked for you. Thank you.


I’m not 100% on my PHP skills, but I have this error when I put the code in my functions.php file:

Your PHP code changes were rolled back due to an error on line 333 of file wp-content/themes/pro-child/functions.php. Please fix and try saving again.

Cannot redeclare x_shortcode_recent_posts_v2code() (previously declared in wp-content/themes/pro-child/functions.php:161)

I have some added code before this for come custom post types that I created. I’m thinking this is what’s causing the error. Can you log in and take a peak at my functions.php file?

Hi Frank,

You already have that existing code in your functions.php, it’s either removing that existing block of code or just change the existing code.

Upon comparing, it seems all of are already implemented so there is no need to add it again.

Or are you referring to the aspect ratio size of the image? If yes, then please replace this CSS

.x-recent-posts .x-recent-posts-img {
    background-size: contain;

with this

.x-recent-posts .x-recent-posts-img {
    background-size: contain;
    padding-bottom: 100%;


That did the trick - thank you!!

You’re welcome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.