If you are a fan of the ThemeZee plugins like me, then you may want to add some extra customizations. To do so, you will need to add ThemeZee plugin support to WordPress with some quick file edits. If you have been on the hunt for a good related post widget for WordPress, then checkout the ThemeZee Widget bundle.
If you are not already using a custom WordPress theme, then I recommend you edit your WordPress theme by creating a fork of your theme. This will prevent overriding any custom code when your theme gets updated.
Custom Recent Posts Thumbnail Size
The one downside of the ThemeZee recent post widget is the default image size. It is so small! 80x80px. For most of all of the WordPress websites I have ever had, that is just too small for a post thumbnail for the sidebar.
To add a custom recent post thumbnail size to the ThemeZee widget, add this code to your theme’s functions.php file. Adjusting the length and width as you desire.
/* Add theme support for ThemeZee widgets */ add_theme_support("themezee-widget-bundle", array( "thumbnail_size" => array ('250', '250', false) // length, width, crop ));
Disable Thumbnail Cropping
One of the other things you may notice about the ThemeZee plugin, is the image cropping. By default, the recent posts will crop the image down to size. And there is no option to turn it off. Unless you add the ability yourself.
On your server browse over the the WordPress plugins directory. Locate the ThemeZee widget bundle folder. Then open the “themezee-widget-bundle.php” file. It should be at this location:
I like to add the ability to control the widget to allow a custom crop setting, just like the custom thumbnail sizes. Find the code that creates the custom thumbnail image size. It looks like this:
add_image_size( 'tzwb-thumbnail', $thumbnail_size, $thumbnail_size, true);
Simply change the hard coded true setting at the end to be the next element in the array of the $thumbnail_size. Like this:
add_image_size( 'tzwb-thumbnail', $thumbnail_size, $thumbnail_size, $thumbnail_size);
Save the file and then regenerate your thumbnails. Now your widget thumbnails will be cropped depending on the settings you set in your theme’s functions.php file like above.
Regenerate your thumbnails?
After you add this code to your WordPress theme, you will most likely need to regenerate your thumbnail files. If so, then I recommend the Simple Image Sizes plugin.
With this plugin you can manage every single one of the custom image sizes being created by your themes and plugins. Browse to the Settings -> Media page to configure each setting individually.
Note: Even though the “tzwb-thumbnail” is on this list, updating it here will not actually change the image. That is why we had to hard code the custom setting into our theme.
All you have to do is select the correct images you want to regenerate, and click the “Regenerate Now” button. The plugin will work it’s magic and regenerate all the images and thumbnails that you selected.