Where to set post-thumbnail size

Hi there

Is it possible to set the size of the themes post-thumbnail? At the moment it looks like Pro is generating a post-thumbnail with a width of 100px. I need a much bigger post-thumbnail size. Where could I set its width to about 1000px?

Thank you very much for your help!

Kind regards,
Felix

Hello Felix,

Thanks for writing to us.

In order to set the thumbnail image size I would suggest you go to the WordPress dashboard —>Settings —>Media —>Set the size from here.

Thanks

Hello Prakash

Thank you very much for your reply. I already tryed to set the media thumbnail size and upload the image again but unfortunately this doesen’t have a effect of the post-thumbnail size.

In the list of my screenshot there are a lot more generated image-sizes than just the three in the media settings. Any idea, where I could find a possibility to set the size of the rest of these images?

Thank you very much for your help!

Kind regards,
Felix

Hello Felix,

The mentioned image size has been set from the theme by default there is no option to change the image size. I would suggest you add your custom image size.


You can call the custom image by using the dynamic contact code. You can set the featured image size in the dynamic content {{dc:post:featured_image_id size="medium"}} . You can chnage the image size as per your desing in place of medium.

Hope it helps
Thanks

Hello Prakash

Thank you very much for your reply and your instuctions. Unfortunately the post-thumbnail is used from the Hotel-Booking-plugin by Motopress to display the property on the search results page. So there is no possibility to choose an other image size to display wthin this results page. At the moment it looks like this:

I have also tryed to replace these small image files via FTP with bigger size images and the same filename in the corresponding directory on the server ( wp-content > uploads etc. ), but even this didn’t show the high-resolution image.

Any idea, what I could do?

Thank you very much for your help!

Kind regards,
Felix

Hello Felix,

The best thing to do is to get onto that Search Results page template or plugin files and check how the plugin displays those items. There should be an image call in the template which could give you the clue what size is being displayed. Be advised that some plugins have defined their image size to be used by the plugin.

Hope this makes sense.

Hello Ruenel

Thank you very much for your reply and the good advice. From the Plugin Author I have got the following answer regarding the image call of the page template:
“The issue is the plugin does not define the image dimensions to be so small on the Search Results page. by default the plugin displays featured images in a full size, so I am pretty sure the small size is defined by the theme or some extra plugins you’re using. Unfortunately there is no option in the plugin itself to force featured images to be resized to original dimensions.”

Do you know, where the image type “Post-Thumbnail” is generated? Is Pro generating this image size?

Thanks again for your help!

Kind regards,
Felix

Hi Ruenel

this is what I have found about the Post-Thumbnail. It seems to be a Theme feature:
https://codex.wordpress.org/Post_Thumbnails

Is it possible to change the image resolution of the Post-Thumbnail?

Thank you very much for your help.

Kind regards,
Felix

Hello Felix,

You can add this custom PHP code to your child theme’s functions.php file to override the post-thumbnail size:

// Reset Post Thumbnail size
// =============================================================================
function custom_x_legacy_setup_thumbnails() {
  // Thumbnails disabled custom stacks
  if (x_is_custom_stack()) {
    return;
  }

  add_theme_support( 'post-thumbnails' );
  set_post_thumbnail_size( 200, 200 );

  $width = x_post_thumbnail_width();
  $width_full = x_post_thumbnail_width_full();

  $height_cropped = intval( round( x_post_thumbnail_width() * 0.558823529 ) );
  $height_cropped_full = intval( round( x_post_thumbnail_width_full() * 0.558823529 ) );

  add_image_size( 'entry',                   $width,      9999,                 false );
  add_image_size( 'entry-cropped',           $width,      $height_cropped,      true  );
  add_image_size( 'entry-fullwidth',         $width_full, 9999,                 false );
  add_image_size( 'entry-cropped-fullwidth', $width_full, $height_cropped_full, true  );

}

remove_action( 'after_setup_theme', 'x_legacy_setup_thumbnails', 1000 );
add_action( 'after_setup_theme', 'custom_x_legacy_setup_thumbnails', 1000 );

The code above serves as an example code. Feel free to modify it when needed. Please note that custom coding is beyond the scope of our support. You must maintain any custom coding to ensure it will still work after any updates or does not create any issues or incompatibility in the future.

Best Regards.

Hello Ruenel

Thank you very much for your great help! At the moment, there is no custom PHP code in my theme’s function.php file. If I insert your code, I am not anymore able to save the file:

As soon as I remove the code, I can save the file again. Any ides what could be the problem?

Thank you very much for your help!

Kind regards,
Felix

Hello Felix,

You use the FTP or cpanel to access the file/wp-content/themes/pro-child/functions.php. You can download the file edit insert the code then reupload the same place.

Hope it helps
Thanks

Hello Prakash

Thank you very much for your reply and your help. I already tryed this but crashed the whole Website. As soon as I override the functions.php file back with the original file, the page works again.

Ids it possible, that my hosting company desn’t allow changes on PHP anymore?

Do you have another idea, what could e the problem?

Thank yu very much for your help!

Kind regards,
Felix

Hello Felix,

Enable the WordPress debug mode. Put back the PHP code in your child theme’s functions.php file. You might be able to see an error message on the site right away. If not, the error log could reveal which line in the code the problem is originating.

By the was, I have tested the code on my local testing server and it works as expected.

Best Regards.

Hello Ruenel

Thank you very much for your god advice and for the link. Unfortunately I was not able to enable the debug mode, I don’t know, what i did wrong.

I have noticed, that I have the same problem with all my Pro websites. No matter which website i choose, the same error message always appears, when inserting a PHP code in the theme’s function.php file.

Any idea, what could be the problem?

Thank you very much for your help!

Kind regards,
Felix

Hey Felix,

With recent WordPress updates, any potential errors in the functions.php file can trigger warnings because even a minor mistake can crash your website. Therefore, it’s best to use FTP or the file manager in your hosting control panel when adding code to your child theme’s functions.php . This way, if there is an error, you can quickly revert the changes.

Hope that helps.

Hi Marc

Thank you very much for your reply and your help! I have already tryed to overwrite the functions.php on my server with FTP. Unfortunately this crashed the website too. I was able to copy the old version of functions.php back to the server and the page was running again.

I have the same problem with all my websites and my hosting company told me, the didn’t change anything on the server settings.

It would be great if I could insert the given code in the functions.php. In the meantime I will overwrite the post-thumbnails with bigger images, which solves the problem for the moment.

Thanks again for your help!

Kind regards,
Felix

Hey Felix,

We’re glad that you’re able to figure it out. You can also try to paste your functions.php code here to test your PHP syntax.

Hope that helps.

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