Skip to content

Instantly share code, notes, and snippets.

@peterwegren
Created December 6, 2016 20:17
Show Gist options
  • Save peterwegren/3678e87655920896cfd6fd970764ed6d to your computer and use it in GitHub Desktop.
Save peterwegren/3678e87655920896cfd6fd970764ed6d to your computer and use it in GitHub Desktop.
Waldo - add image sizes.
<?php
/* in your functions.php */
add_image_size( 'small', 420, 420, false );
// default WP sizes, update dimensions under Settings > Media
// add_image_size( 'medium', 768, 768, false );
// add_image_size( 'large', 1024, 1024, false );
add_image_size( 'xlarge', 1600, 1600, false );
// add support for additional image sizes by following this format: (https://developer.wordpress.org/reference/functions/add_image_size/)
// add_image_size( 'x', width, height, true/false );
/* in waldo.php */
// default waldo_sizes array:
// $this->waldo_sizes = array(
// 'small' => '', // default size, no 'min-width' media query required
// 'medium' => '420',
// 'large' => '768',
// 'xlarge' => '1024'
// );
// update with additional image sizes and breakpoint values
$this->waldo_sizes = array(
'small' => '', // default size, no 'min-width' media query required
'medium' => '420',
'large' => '768',
'xlarge' => '1024',
// '[image size]' => '[min-width breakpoint value]'
);
// NOTE: the 'min-width breakpoint value' should be equal to, or less than the width value of the previous image size (i.e. 'xlarge' is set to '1024', which is the width value of the large image size)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment