How to Change the Size of the Featured Image Displayed by the Featured Page Widget

Featured Page widget is one of the most popular widgets in our theme. It displays your favorite page in a beautiful way with the featured image, excerpt text and 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 the predefined settings for the cropping size of the featured images, set in a way they work best with the theme design. There are intentionally no setting for changing that on the fly easily, because you can easily break your site. However, if you really want to change this, there is a way of doing that in the PHP code directly. Learning how to setup the child theme and how to write PHP code it 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 the 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 the featured image sizes:

  • pw/featured_page_widget_page_box_image_size and
  • 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.