Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of fpw_image_size filter in Feature a Page Widget 2.0. By default, Feature a Page Widget registers three sizes, one for each layout: fpw_big, fpw_square, fpw_banner. NOTE: To produce consistent image sizes and a good widget layout, CSS rules like max-width may at times affect the image's apparent size on the front end.
* replace one of the widget image sizes
* examples replaces the banner layout's image with the 'large' size image from Settings > Media
* If you replacing $size with a custom image size, you must register that separately with add_image_size()
* @param $size string slug of registered image size
* @return string|array slug of registered image size or "array( width, height )" (not recommended)
function fpw_change_image_size( $size ) {
// check if image uses the "banner" layout image size
if( $size === 'fpw_banner' ) {
$size = 'large';
return $size;
add_filter( 'fpw_image_size', 'fpw_change_image_size' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment