How to change the size of the Featured Image displayed by the Featured Page widget

The Featured Page widget is one of the most popular widgets in our themes. It displays your favorite page in a beautiful way with the featured image, excerpt text, and a read-more link. In this guide, you will learn how you can change the size of the featured image displayed by this widget.

All our themes come with predefined settings for cropping featured images so they work best with the theme’s design. There are — intentionally — no settings for changing that easily because you can break your site.

However, if you really want to change these settings, there is a way of doing that in the PHP code directly. Learning how to set up a child theme and how to write PHP code is out of the scope of this help-center article (but we do have an ultimate guide to child themes for you), and out of the scope of theme support either, so if you’re not absolutely sure what you’re doing, please let us do the work for you in a professional way.

WordPress filters

There are two filters available for setting featured-image sizes:

  • pw/featured_page_widget_page_box_image_size
  • pw/featured_page_widget_inline_image_size

for the page box and the inline layouts, respectively. Here is how you use them:

function set_page_box_image_size( $image ) {
	$image['width']  = 520;
	$image['height'] = 260;
	return $image;
}
add_filter( 'pw/featured_page_widget_page_box_image_size', 'set_page_box_image_size', 30 );

After you’ve got the code in place, you have to regenerate the thumbnails if you want the changes to be applied to your previously-uploaded images.